Git fork

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>

authored by

brian m. carlson and committed by
Junio C Hamano
f957ce07 6866b422

+10 -2
+10 -2
t/t4042-diff-textconv-caching.sh
··· 120 120 ' 121 121 122 122 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) && 123 131 mkdir -p non-repo && 124 132 echo one >non-repo/one && 125 133 echo two >non-repo/two && ··· 129 137 -c diff.test.textconv="tr a-z A-Z <" \ 130 138 -c diff.test.cachetextconv=true \ 131 139 diff --no-index one two >actual && 132 - cat >expect <<-\EOF && 140 + cat >expect <<-EOF && 133 141 diff --git a/one b/two 134 - index 5626abf..f719efd 100644 142 + index $oid1..$oid2 100644 135 143 --- a/one 136 144 +++ b/two 137 145 @@ -1 +1 @@