Repository navigation
Commit b911984
fix(repo): return actual historical paths from incremental blame
<!-- agent -->
`Repo.blame_incremental()` copied Git's `filename` field into
`BlameEntry.orig_path` without interpreting its C-style quoting. After
renaming `café.txt` to `current.txt`, callers received
`"caf\303\251.txt"` instead of `café.txt`, so following an attribution
back to its original tree entry failed. Quotes, backslashes and control
characters had the same problem, even with `core.quotePath=false`.
Decode quoted filenames with the existing `git.diff._unquote_path()`
helper before constructing each entry. This shared point handles both
newly encountered and cached commits, leaves unquoted names unchanged,
and retains `safe_decode()`'s byte-preserving `surrogateescape` behavior.
`Repo.blame(..., incremental=True)` receives the same correction. Blame
continues to use Git's CLI on both backends; this is an output-parser fix,
not a new Gix implementation.
Add an independently written tree-based fixture and regression covering
eight historical filenames with both `core.quotePath` settings. Renaming
then editing the middle line produces two separated entries attributed
to the same original commit, exercising both parser branches. Check the
commit, original path and both line ranges through both public entry
points. Tree construction avoids platform restrictions on checking out
control-character and invalid-UTF-8 filenames.
The regression failed in ten quoted-filename subcases on each backend
before the fix and passes afterward. Repository and diff tests pass on
both backends; Ruff lint/format, mypy and ShellCheck also pass.
Git evidence: the comparison binary is `git version 2.54.0 (Apple
Git-157)`. Reference checkout revision
`6de20f6092dcf9bdb1c8efe03db4b70c82b423dd` documents the terminating
`filename` field in `Documentation/git-blame.adoc`; its
`builtin/blame.c:write_filename_info()` uses `write_name_quoted()`.
The regression's real `git blame --incremental HEAD -- current.txt`
output quotes the historical path in both entries for the original
commit, matching that format.
Independent solution to the problem reported and investigated by
`Keerthana-64` in #2314.
No implementation or tests were taken from that PR.
Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>1 parent 4debc51 commit b911984
3 files changed
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
| 1296 | + | |
| 1297 | + | |
1296 | 1298 | | |
1297 | 1299 | | |
1298 | 1300 | | |
| |||
1375 | 1377 | | |
1376 | 1378 | | |
1377 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1378 | 1383 | | |
1379 | 1384 | | |
1380 | 1385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
757 | 786 | | |
758 | 787 | | |
759 | 788 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments