Skip to content

Commit f957ce0

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6866b42 commit f957ce0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

t/t4042-diff-textconv-caching.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ test_expect_success 'log notes cache and still use cache for -p' '
120120
'
121121

122122
test_expect_success 'caching is silently ignored outside repo' '
123+
test_oid_cache <<-\EOM &&
124+
oid1 sha1:5626abf
125+
oid1 sha256:a4ed1f3
126+
oid2 sha1:f719efd
127+
oid2 sha256:aa9e7dc
128+
EOM
129+
oid1=$(test_oid --hash=builtin oid1) &&
130+
oid2=$(test_oid --hash=builtin oid2) &&
123131
mkdir -p non-repo &&
124132
echo one >non-repo/one &&
125133
echo two >non-repo/two &&
@@ -129,9 +137,9 @@ test_expect_success 'caching is silently ignored outside repo' '
129137
-c diff.test.textconv="tr a-z A-Z <" \
130138
-c diff.test.cachetextconv=true \
131139
diff --no-index one two >actual &&
132-
cat >expect <<-\EOF &&
140+
cat >expect <<-EOF &&
133141
diff --git a/one b/two
134-
index 5626abf..f719efd 100644
142+
index $oid1..$oid2 100644
135143
--- a/one
136144
+++ b/two
137145
@@ -1 +1 @@

0 commit comments

Comments
 (0)