Skip to content

Commit d27cd97

Browse files
committed
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)
1 parent b306169 commit d27cd97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ def _read(self, fp, fpname):
216216
if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
217217
# no leading whitespace
218218
continue
219+
# continuation line?
220+
if line[0].isspace() and cursect is not None and optname:
221+
value = line.strip()
222+
if value:
223+
cursect[optname] = "%s\n%s" % (cursect[optname], value)
219224
else:
220225
# is it a section header?
221226
mo = self.SECTCRE.match(line)

0 commit comments

Comments
 (0)