Skip to content

Commit 9d619f2

Browse files
bk2204gitster
authored andcommitted
t5300: choose the built-in hash outside of a repo
Right now, the built-in default hash is always SHA-1, but that will change in a future commit. Instead of assuming that operating outside of a repository will always use SHA-1, look up the default hash algorithm for operating outside of a repository using an appropriate environment variable, which will always be correct. Additionally, for operations outside of a repository, use the DEFAULT_HASH_ALGORITHM prerequisite rather than SHA1. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f957ce0 commit 9d619f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t5300-pack-object.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ test_expect_success 'index-pack --strict <pack> works in non-repo' '
525525
test_path_is_file foo.idx
526526
'
527527

528-
test_expect_success SHA1 'show-index works OK outside a repository' '
528+
test_expect_success DEFAULT_HASH_ALGORITHM 'show-index works OK outside a repository' '
529529
nongit git show-index <foo.idx
530530
'
531531

@@ -658,7 +658,7 @@ do
658658
test_commit -C repo initial &&
659659
git -C repo repack -ad &&
660660
git -C repo verify-pack "$(pwd)"/repo/.git/objects/pack/*.idx &&
661-
if test $hash = sha1
661+
if test $hash = $GIT_TEST_BUILTIN_HASH
662662
then
663663
nongit git verify-pack "$(pwd)"/repo/.git/objects/pack/*.idx
664664
else
@@ -676,7 +676,7 @@ do
676676
test_commit -C repo initial &&
677677
git -C repo repack -ad &&
678678
git -C repo index-pack --verify "$(pwd)"/repo/.git/objects/pack/*.pack &&
679-
if test $hash = sha1
679+
if test $hash = $GIT_TEST_BUILTIN_HASH
680680
then
681681
nongit git index-pack --verify "$(pwd)"/repo/.git/objects/pack/*.pack
682682
else

0 commit comments

Comments
 (0)