Skip to content

Commit b227bea

Browse files
bk2204gitster
authored andcommitted
t5607: avoid using prerequisites to select algorithm
In this test, we currently use the SHA1 prerequisite to specify the algorithm we're using to test, since SHA-256 bundles are always v3, whereas SHA-1 bundles default to v2, and as a result the default output differs. However, this causes a problem if we run with GIT_TEST_FAIL_PREREQS set, since that means that we'll unexpectedly fail the SHA1 prerequisite, resulting in incorrect expected output. Let's fix this by checking against the built-in data called "algo", which tells us which algorithm is in use. This should work in any situation, making our test a little more robust. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d213e4 commit b227bea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

t/t5607-clone-bundle.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ test_expect_success 'ridiculously long subject in boundary' '
9191
9292
git fetch long-subject-bundle.bdl &&
9393
94-
if ! test_have_prereq SHA1
94+
algo=$(test_oid algo) &&
95+
if test "$algo" != sha1
9596
then
9697
echo "@object-format=sha256"
9798
fi >expect &&
@@ -100,7 +101,7 @@ test_expect_success 'ridiculously long subject in boundary' '
100101
$(git rev-parse HEAD) HEAD
101102
EOF
102103
103-
if test_have_prereq SHA1
104+
if test "$algo" = sha1
104105
then
105106
head -n 3 long-subject-bundle.bdl
106107
else

0 commit comments

Comments
 (0)