]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5607: avoid using prerequisites to select algorithm
authorbrian m. carlson <sandals@crustytoothpaste.net>
Wed, 11 Aug 2021 23:16:44 +0000 (23:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Aug 2021 05:24:32 +0000 (22:24 -0700)
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 <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5607-clone-bundle.sh

index ed0d911e953e7536f8fb2ce7cc885a3a7dbce167..51705aa86a172edfcdf9f41d9640f93c8667ebb9 100755 (executable)
@@ -91,7 +91,8 @@ test_expect_success 'ridiculously long subject in boundary' '
 
        git fetch long-subject-bundle.bdl &&
 
-       if ! test_have_prereq SHA1
+       algo=$(test_oid algo) &&
+       if test "$algo" != sha1
        then
                echo "@object-format=sha256"
        fi >expect &&
@@ -100,7 +101,7 @@ test_expect_success 'ridiculously long subject in boundary' '
        $(git rev-parse HEAD) HEAD
        EOF
 
-       if test_have_prereq SHA1
+       if test "$algo" = sha1
        then
                head -n 3 long-subject-bundle.bdl
        else