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>
brian m. carlson committed
Dec 21, 2019 at 19:49 UTC
82d5aeb1e606d6fb397d92c1b8ec95fd94b71d95
1 file changed
+10
-3
t/t5324-split-commit-graph.sh
+10
-3
@@ -11,7 +11,14 @@ test_expect_success 'setup repo' '
11
git config gc.writeCommitGraph false &&
12
infodir=".git/objects/info" &&
13
graphdir="$infodir/commit-graphs" &&
14
- test_oid_init
14
+ test_oid_init &&
15
+ test_oid_cache <<-EOM
16
+ shallow sha1:1760
17
+ shallow sha256:2064
18
+
19
+ base sha1:1376
20
+ base sha256:1496
21
+ EOM
22
'
23
24
graph_read_expect() {
@@ -248,7 +255,7 @@ test_expect_success 'verify hashes along chain, even in shallow' '
255
cd verify &&
256
git commit-graph verify &&
257
base_file=$graphdir/graph-$(head -n 1 $graphdir/commit-graph-chain).graph &&
251
- corrupt_file "$base_file" 1760 "\01" &&
258
+ corrupt_file "$base_file" $(test_oid shallow) "\01" &&
259
test_must_fail git commit-graph verify --shallow 2>test_err &&
260
grep -v "^+" test_err >err &&
261
test_i18ngrep "incorrect checksum" err
@@ -275,7 +282,7 @@ test_expect_success 'warn on base graph chunk incorrect' '
282
cd base-chunk &&
283
git commit-graph verify &&
284
base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
278
- corrupt_file "$base_file" 1376 "\01" &&
285
+ corrupt_file "$base_file" $(test_oid base) "\01" &&
286
git commit-graph verify --shallow 2>test_err &&
287
grep -v "^+" test_err >err &&
288
test_i18ngrep "commit-graph chain does not match" err