You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: join backslash line continuations when reading config values - #2227
git config joins an unquoted value that ends in a backslash with the next line: the backslash and the newline are removed and the next line is appended verbatim. Reproducing with git itself:
GitPython only implemented multi-line values for quoted strings. For unquoted values the continuation line was silently dropped — GitConfigParser read back line1\ and the line2 content vanished, truncating whatever the user had stored (aliases, hook commands, any hand-edited multi-line value).
The fix reads the continuation inside _read and joins it, chaining across lines that themselves end in a backslash, with the exact rules git uses:
a single trailing backslash → continuation, next line appended verbatim (leading whitespace included)
an even number of trailing backslashes → an escaped one, value ends there (val\\\\ stays val\\\\)
a lone backslash right at end-of-file → dropped
All five cases are asserted against git's own output in the new test.
git config joins an unquoted value that ends in a backslash with the next line: the backslash and the newline are removed and the next line is appended verbatim. Reproducing with git itself:
GitPython only implemented multi-line values for quoted strings. For unquoted values the continuation line was silently dropped —
GitConfigParserread backline1\and theline2content vanished, truncating whatever the user had stored (aliases, hook commands, any hand-edited multi-line value).The fix reads the continuation inside
_readand joins it, chaining across lines that themselves end in a backslash, with the exact rules git uses:val\\\\staysval\\\\)All five cases are asserted against git's own output in the new test.