test-lib: compute the compatibility hash so tests may use it
Inspired-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
c68be1fd31
commit
48b16ab231
|
@ -1599,7 +1599,16 @@ test_set_hash () {
|
||||||
|
|
||||||
# Detect the hash algorithm in use.
|
# Detect the hash algorithm in use.
|
||||||
test_detect_hash () {
|
test_detect_hash () {
|
||||||
test_hash_algo="${GIT_TEST_DEFAULT_HASH:-sha1}"
|
case "$GIT_TEST_DEFAULT_HASH" in
|
||||||
|
"sha256")
|
||||||
|
test_hash_algo=sha256
|
||||||
|
test_compat_hash_algo=sha1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
test_hash_algo=sha1
|
||||||
|
test_compat_hash_algo=sha256
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load common hash metadata and common placeholder object IDs for use with
|
# Load common hash metadata and common placeholder object IDs for use with
|
||||||
|
@ -1651,6 +1660,12 @@ test_oid () {
|
||||||
local algo="${test_hash_algo}" &&
|
local algo="${test_hash_algo}" &&
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--hash=storage)
|
||||||
|
algo="$test_hash_algo" &&
|
||||||
|
shift;;
|
||||||
|
--hash=compat)
|
||||||
|
algo="$test_compat_hash_algo" &&
|
||||||
|
shift;;
|
||||||
--hash=*)
|
--hash=*)
|
||||||
algo="${1#--hash=}" &&
|
algo="${1#--hash=}" &&
|
||||||
shift;;
|
shift;;
|
||||||
|
|
Loading…
Reference in New Issue