mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
t5324: make hash size independent
There are some offsets in the commit graph files used to corrupt data. Compute these offsets for both SHA-1 and SHA-256 so that the test works with either. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3c5e65cac1
commit
82d5aeb1e6
|
@ -11,7 +11,14 @@ test_expect_success 'setup repo' '
|
|||
git config gc.writeCommitGraph false &&
|
||||
infodir=".git/objects/info" &&
|
||||
graphdir="$infodir/commit-graphs" &&
|
||||
test_oid_init
|
||||
test_oid_init &&
|
||||
test_oid_cache <<-EOM
|
||||
shallow sha1:1760
|
||||
shallow sha256:2064
|
||||
|
||||
base sha1:1376
|
||||
base sha256:1496
|
||||
EOM
|
||||
'
|
||||
|
||||
graph_read_expect() {
|
||||
|
@ -248,7 +255,7 @@ test_expect_success 'verify hashes along chain, even in shallow' '
|
|||
cd verify &&
|
||||
git commit-graph verify &&
|
||||
base_file=$graphdir/graph-$(head -n 1 $graphdir/commit-graph-chain).graph &&
|
||||
corrupt_file "$base_file" 1760 "\01" &&
|
||||
corrupt_file "$base_file" $(test_oid shallow) "\01" &&
|
||||
test_must_fail git commit-graph verify --shallow 2>test_err &&
|
||||
grep -v "^+" test_err >err &&
|
||||
test_i18ngrep "incorrect checksum" err
|
||||
|
@ -275,7 +282,7 @@ test_expect_success 'warn on base graph chunk incorrect' '
|
|||
cd base-chunk &&
|
||||
git commit-graph verify &&
|
||||
base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
|
||||
corrupt_file "$base_file" 1376 "\01" &&
|
||||
corrupt_file "$base_file" $(test_oid base) "\01" &&
|
||||
git commit-graph verify --shallow 2>test_err &&
|
||||
grep -v "^+" test_err >err &&
|
||||
test_i18ngrep "commit-graph chain does not match" err
|
||||
|
|
Loading…
Reference in a new issue