diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2023-10-01 21:40:31 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 14:57:40 -0700 |
| commit | 48b16ab231bc20ad86dc94bcf64647a83d374a2b (patch) | |
| tree | 858e268f5550fc316076c8718c4076f2b0fc943b /t/test-lib-functions.sh | |
| parent | builtin/ls-tree: let the oid determine the output algorithm (diff) | |
| download | git-48b16ab231bc20ad86dc94bcf64647a83d374a2b.tar.gz git-48b16ab231bc20ad86dc94bcf64647a83d374a2b.zip | |
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>
Diffstat (limited to 't/test-lib-functions.sh')
| -rw-r--r-- | t/test-lib-functions.sh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 2f8868caa1..92b462e2e7 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1599,7 +1599,16 @@ test_set_hash () { # Detect the hash algorithm in use. 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 @@ -1651,6 +1660,12 @@ test_oid () { local algo="${test_hash_algo}" && case "$1" in + --hash=storage) + algo="$test_hash_algo" && + shift;; + --hash=compat) + algo="$test_compat_hash_algo" && + shift;; --hash=*) algo="${1#--hash=}" && shift;; |
