Commit 1461c35
committed
fix: skip a UTF-8 BOM when reading config files
git ignores a UTF-8 BOM at the start of a config file, so a file written by a
Windows editor still parses. GitConfigParser raised MissingSectionHeaderError
instead, because the BOM was decoded into the first line, which then no longer
matched a section header.
Evidence on git 2.47.3: `git config -f bom.cfg --list` prints core.bare=true
for a file starting with the three BOM bytes, while GitPython raised
MissingSectionHeaderError. With this change both read the same values, also
when the BOM file is pulled in through include.path.
The new test fails without the change.1 parent 303c48f commit 1461c35
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
554 | | - | |
| 553 | + | |
| 554 | + | |
555 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
556 | 561 | | |
557 | 562 | | |
558 | 563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
357 | 368 | | |
358 | 369 | | |
359 | 370 | | |
| |||
0 commit comments