Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
  • Loading branch information
jkeating committed May 25, 2011
commit d27cd97d8317094454510e904b49c5c537fa202c
5 changes: 5 additions & 0 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down