◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
16 changes: 12 additions & 4 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,26 @@ def string_decode(v: str) -> str:
if mo:
# We might just have handled the last line, which could contain a quotation we want to remove.
optname, vi, optval = mo.group("option", "vi", "value")
if vi in ("=", ":") and ";" in optval and not optval.strip().startswith('"'):
pos = optval.find(";")
if pos != -1 and optval[pos - 1].isspace():
optval = optval[:pos]
optval = optval.strip()
optname = self.optionxform(optname.rstrip())
if len(optval) > 1 and optval[0] == '"' and optval[-1] != '"':
is_multi_line = True
optval = string_decode(optval[1:])
elif len(optval) > 1 and optval[0] == '"' and optval[-1] == '"':
optval = optval[1:-1]
# END handle multi-line
# Preserves multiple values for duplicate optnames.
cursect.add(optname, optval)
else:
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/git_config_with_quotes_escapes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Loading
Toggle all file notes Toggle all file annotations