Skip to content

Commit 48b16ab

Browse files
ebiedermgitster
authored andcommitted
test-lib: compute the compatibility hash so tests may use it
Inspired-by: brian m. carlson <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c68be1f commit 48b16ab

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

t/test-lib-functions.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,16 @@ test_set_hash () {
15991599

16001600
# Detect the hash algorithm in use.
16011601
test_detect_hash () {
1602-
test_hash_algo="${GIT_TEST_DEFAULT_HASH:-sha1}"
1602+
case "$GIT_TEST_DEFAULT_HASH" in
1603+
"sha256")
1604+
test_hash_algo=sha256
1605+
test_compat_hash_algo=sha1
1606+
;;
1607+
*)
1608+
test_hash_algo=sha1
1609+
test_compat_hash_algo=sha256
1610+
;;
1611+
esac
16031612
}
16041613

16051614
# Load common hash metadata and common placeholder object IDs for use with
@@ -1651,6 +1660,12 @@ test_oid () {
16511660
local algo="${test_hash_algo}" &&
16521661

16531662
case "$1" in
1663+
--hash=storage)
1664+
algo="$test_hash_algo" &&
1665+
shift;;
1666+
--hash=compat)
1667+
algo="$test_compat_hash_algo" &&
1668+
shift;;
16541669
--hash=*)
16551670
algo="${1#--hash=}" &&
16561671
shift;;

0 commit comments

Comments
 (0)