t5324: adjust tests for corrupt commit-graph

In a future commit, we'll no longer allow uppercase object IDs.  When
that happens, t5324 will fail because the error message from corrupting
commit-graph files will be different.  The current test looks for an
error message that occurs when the commit-graph file has a name that is
parseable as a valid object ID but is not a valid commit-graph file
(which, on case-sensitive systems, is of course checked case
sensitively).

However, in the future, we need the object ID to continue to be valid,
and that means that the hex character we use must be lowercase.  In
SHA-256, though, one of the characters we want to corrupt is
legitimately already an "a", so switch to using the character "b" in
both of these cases, which is the correct character for neither SHA-1
nor SHA-256.  If we adopt another hash algorithm in the future, we may
need to adjust these values again.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
seen
brian m. carlson 2026-09-07 19:59:39 +00:00 committed by Junio C Hamano
parent f818ba400f
commit c261979e89
1 changed files with 2 additions and 2 deletions

View File

@ -349,7 +349,7 @@ test_expect_success 'verify after commit-graph-chain corruption (base)' '
test_must_fail git commit-graph verify 2>test_err &&
grep -v "^+" test_err >err &&
test_grep "invalid commit-graph chain" err &&
corrupt_file "$graphdir/commit-graph-chain" 30 "A" &&
corrupt_file "$graphdir/commit-graph-chain" 30 "b" &&
test_must_fail git commit-graph verify 2>test_err &&
grep -v "^+" test_err >err &&
test_grep "unable to find all commit-graph files" err
@ -364,7 +364,7 @@ test_expect_success 'verify after commit-graph-chain corruption (tip)' '
test_must_fail git commit-graph verify 2>test_err &&
grep -v "^+" test_err >err &&
test_grep "invalid commit-graph chain" err &&
corrupt_file "$graphdir/commit-graph-chain" 70 "A" &&
corrupt_file "$graphdir/commit-graph-chain" 70 "b" &&
test_must_fail git commit-graph verify 2>test_err &&
grep -v "^+" test_err >err &&
test_grep "unable to find all commit-graph files" err