aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2025-07-01 21:22:34 +0000
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:58:25 -0700
commitf957ce078f61266b3212b88d9c357a1b7f071a6f (patch)
tree37c4c955be13a3bb2e330d8653d528581b6d5bb2
parent6866b422608ebfd25ba65935fd2d5378029ec3ea (diff)
downloadgit-f957ce078f61266b3212b88d9c357a1b7f071a6f.tar.gz
t4042: 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, provide constants for both algorithms and then simply ask test_oid for the built-in hash instead, which will always be correct. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t4042-diff-textconv-caching.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/t/t4042-diff-textconv-caching.sh b/t/t4042-diff-textconv-caching.sh
index ff0e73531b..31018ceba2 100755
--- a/t/t4042-diff-textconv-caching.sh
+++ b/t/t4042-diff-textconv-caching.sh
@@ -120,6 +120,14 @@ test_expect_success 'log notes cache and still use cache for -p' '
'
test_expect_success 'caching is silently ignored outside repo' '
+ test_oid_cache <<-\EOM &&
+ oid1 sha1:5626abf
+ oid1 sha256:a4ed1f3
+ oid2 sha1:f719efd
+ oid2 sha256:aa9e7dc
+ EOM
+ oid1=$(test_oid --hash=builtin oid1) &&
+ oid2=$(test_oid --hash=builtin oid2) &&
mkdir -p non-repo &&
echo one >non-repo/one &&
echo two >non-repo/two &&
@@ -129,9 +137,9 @@ test_expect_success 'caching is silently ignored outside repo' '
-c diff.test.textconv="tr a-z A-Z <" \
-c diff.test.cachetextconv=true \
diff --no-index one two >actual &&
- cat >expect <<-\EOF &&
+ cat >expect <<-EOF &&
diff --git a/one b/two
- index 5626abf..f719efd 100644
+ index $oid1..$oid2 100644
--- a/one
+++ b/two
@@ -1 +1 @@