From d27cd97d8317094454510e904b49c5c537fa202c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 25 May 2011 13:18:49 -0700 Subject: [PATCH] Handle indented config sections This brings over some new code from RawConfigParser that handles lines that start with spaces but are also sections themselves, eg: [color] ui = auto [color "branch"] Previously this would cause a traceback. (https://bugzilla.redhat.com/show_bug.cgi?id=706218) --- git/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git/config.py b/git/config.py index 209f2ffef..31226fa63 100644 --- a/git/config.py +++ b/git/config.py @@ -216,6 +216,11 @@ def _read(self, fp, fpname): if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR": # no leading whitespace continue + # continuation line? + if line[0].isspace() and cursect is not None and optname: + value = line.strip() + if value: + cursect[optname] = "%s\n%s" % (cursect[optname], value) else: # is it a section header? mo = self.SECTCRE.match(line)