Commit 1551238
fix: allow relative config paths with includes (#2103)
GitConfigParser asserted while resolving a relative include whenever the
top-level configuration file had itself been supplied as a relative path.
A regression test constructs that combination and verifies the included
value is available.
Normalize path-based inputs to absolute paths before reading them. This
lets relative includes resolve against the containing file and ensures
cycle detection uses the same canonical spelling for top-level and
included paths.
This matches Git's documented include behavior and the relative and
chained-relative coverage in t/t1305-config-include.sh.
Validation:
- uv run pytest -q test/test_config.py
- uv run pre-commit run --files git/config.py test/test_config.py
- uv run mypy git/config.py
- git diff --check
- full pytest: 631 passed, 75 skipped, 34 unrelated environment failures
(uninitialized nested submodules and missing legacy master branch)1 parent 40f1424 commit 1551238
2 files changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| 637 | + | |
| 638 | + | |
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
313 | 327 | | |
314 | 328 | | |
315 | 329 | | |
| |||
0 commit comments