Commit 075a664
NK
fix: join backslash line continuations when reading config values
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, so 'k = line1\' followed by ' line2' reads back
as 'line1 line2'. GitPython only implemented multi-line values for
quoted strings; for unquoted values the continuation line was silently
dropped, truncating whatever was stored in the config.
Read the continuation inside _read and join it, chaining across lines
that themselves end in a backslash. An even number of trailing
backslashes is an escaped one, so the value ends there; a single
backslash right at end-of-file is dropped, matching git. Verified
against git itself for every case covered by the new tests.1 parent 62d1e2f commit 075a664
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
517 | 536 | | |
518 | 537 | | |
519 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
146 | 166 | | |
147 | 167 | | |
148 | 168 | | |
| |||
0 commit comments