Skip to content

Commit bb378dd

Browse files
codexByron
authored andcommitted
test(repo): preserve carriage returns in blame fixtures
Windows CI with Git `2.56.0.windows.2` fails the historical-path regression for its combined control-character filename under both `core.quotePath` settings. The attributed original commit is `e5ed22d659d5aa4ff5f7527069752d20f74fc2d9`, which a local Git reproduction matches exactly when removing the carriage return from the original path. Keeping that byte produces `73813b4d58d085503f9426c6e50ce5c201f715b6`. The failure therefore comes from fixture creation losing the byte, rather than incremental blame returning a different path from the stored tree. Represent special paths as Git C-quoted text and feed the original tree through `git mktree` instead of sending raw control bytes to `mktree -z`. Git decodes the escapes while constructing the tree. This keeps carriage returns out of the raw fixture input and retains coverage for every control character, invalid UTF-8, literal escapes, and both quoting settings. The parser implementation and expected results are unchanged. The focused regression passes locally on both backends with all sixteen subcases. Raw `git ls-tree -z HEAD~2` confirms the carriage return is present, and the original commit retains its expected ID. ShellCheck, `bash -n`, and `git diff --check` pass. Windows CI must verify the fixture on its native Git/Bash combination.
1 parent 874d8d9 commit bb378dd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎tests/fixtures/blame-paths.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
22
set -eu
3-
# Tree entries allow historical names that cannot be checked out on every platform.
4-
paths=('plain.txt' ' spaced name.txt ' $'caf\303\251.txt' $'byte-\377.txt' '"literal-\303\251.txt"' 'quote"name.txt' 'back\slash.txt' $'control\a\b\t\n\v\f\r.txt')
3+
# C-quoted tree input preserves control bytes through Windows fixture creation.
4+
paths=('plain.txt' ' spaced name.txt ' '"caf\303\251.txt"' '"byte-\377.txt"' '"\"literal-\\303\\251.txt\""' '"quote\"name.txt"' '"back\\slash.txt"' '"control\a\b\t\n\v\f\r.txt"')
55
for i in "${!paths[@]}"; do
66
git init -q --initial-branch=main "$i"
77
(
88
cd "$i"
99
git config core.quotePath "$1"
1010
blob=$(printf 'first\nmiddle\nlast\n' | git hash-object -w --stdin)
11-
tree=$(printf '100644 blob %s\t%s\0' "$blob" "${paths[$i]}" | git mktree -z)
11+
tree=$(printf '100644 blob %s\t%s\n' "$blob" "${paths[$i]}" | git mktree)
1212
original=$(git commit-tree "$tree" -m original)
1313
tree=$(printf '100644 blob %s\tcurrent.txt\0' "$blob" | git mktree -z)
1414
renamed=$(git commit-tree "$tree" -p "$original" -m rename)

0 commit comments

Comments
 (0)