Skip to content

Commit b6e5005

Browse files
bk2204gitster
authored andcommitted
t9301: make hash size independent
Instead of using a hard-coded all-zeros object ID, use $ZERO_OID. Compute the length of the object IDs in use and use this instead of hard-coding the constant 40. Signed-off-by: brian m. carlson <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 287bb3a commit b6e5005

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/t9301-fast-import-notes.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,13 @@ test_expect_success 'add lots of commits and notes' '
470470
'
471471

472472
test_expect_success 'verify that lots of notes trigger a fanout scheme' '
473+
hexsz=$(test_oid hexsz) &&
473474
474475
# None of the entries in the top-level notes tree should be a full SHA1
475476
git ls-tree --name-only refs/notes/many_notes |
476477
while read path
477478
do
478-
if test $(expr length "$path") -ge 40
479+
if test $(expr length "$path") -ge $hexsz
479480
then
480481
return 1
481482
fi
@@ -518,7 +519,7 @@ test_expect_success 'verify that importing a notes tree respects the fanout sche
518519
git ls-tree --name-only refs/notes/other_notes |
519520
while read path
520521
do
521-
if test $(expr length "$path") -ge 40
522+
if test $(expr length "$path") -ge $hexsz
522523
then
523524
return 1
524525
fi
@@ -593,7 +594,7 @@ test_expect_success 'verify that changing notes respect existing fanout' '
593594
git ls-tree --name-only refs/notes/many_notes |
594595
while read path
595596
do
596-
if test $(expr length "$path") -ge 40
597+
if test $(expr length "$path") -ge $hexsz
597598
then
598599
return 1
599600
fi
@@ -616,7 +617,7 @@ i=$(($num_commits - $remaining_notes))
616617
for sha1 in $(git rev-list -n $i refs/heads/many_commits)
617618
do
618619
cat >>input <<INPUT_END
619-
N 0000000000000000000000000000000000000000 $sha1
620+
N $ZERO_OID $sha1
620621
INPUT_END
621622
done
622623

@@ -646,7 +647,6 @@ test_expect_success 'remove lots of notes' '
646647
'
647648

648649
test_expect_success 'verify that removing notes trigger fanout consolidation' '
649-
650650
# All entries in the top-level notes tree should be a full SHA1
651651
git ls-tree --name-only -r refs/notes/many_notes |
652652
while read path
@@ -656,7 +656,7 @@ test_expect_success 'verify that removing notes trigger fanout consolidation' '
656656
test "$path" = "deadbeef" && continue
657657
test "$path" = "de/adbeef" && continue
658658
659-
if test $(expr length "$path") -ne 40
659+
if test $(expr length "$path") -ne $hexsz
660660
then
661661
return 1
662662
fi

0 commit comments

Comments
 (0)