Skip to content

Commit c49fe07

Browse files
bk2204gitster
authored andcommitted
t: make SHA1 prerequisite depend on default hash
Currently, the SHA1 prerequisite depends on the output of git hash-object. However, in order for that to produce sane behavior, we must be in a repository. If we are not, the default will remain SHA-1, and we'll produce wrong results if we're using SHA-256 for the testsuite but the test assertion starts when we're not in a repository. Check the environment variable we use for this purpose, leaving it to default to SHA-1 if none is specified. Signed-off-by: brian m. carlson <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 02a32db commit c49fe07

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

t/test-lib.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,11 @@ test_lazy_prereq CURL '
16891689
# which will not work with other hash algorithms and tests that work but don't
16901690
# test anything meaningful (e.g. special values which cause short collisions).
16911691
test_lazy_prereq SHA1 '
1692-
test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
1692+
case "$GIT_DEFAULT_HASH" in
1693+
sha1) true ;;
1694+
"") test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 ;;
1695+
*) false ;;
1696+
esac
16931697
'
16941698

16951699
test_lazy_prereq REBASE_P '

0 commit comments

Comments
 (0)