]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5703: make test work with SHA-256
authorbrian m. carlson <sandals@crustytoothpaste.net>
Fri, 7 Feb 2020 00:52:51 +0000 (00:52 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Feb 2020 19:07:31 +0000 (11:07 -0800)
This test used an object ID which was 40 hex characters in length,
causing the test not only not to pass, but to hang, when run with
SHA-256 as the hash.  Change this value to a fixed dummy object ID using
test_oid_init and test_oid.

Furthermore, ensure we extract an object ID of the appropriate length
using cut with fields instead of a fixed length.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5703-upload-pack-ref-in-want.sh

index 1424fabd4aa5585f6eb8129dd48468dcab35753b..8aeeaac50916bd02f8dd7b68676a48dea7e389e3 100755 (executable)
@@ -19,7 +19,7 @@ get_actual_commits () {
                }' <out | test-tool pkt-line unpack-sideband >o.pack &&
        git index-pack o.pack &&
        git verify-pack -v o.idx >objs &&
-       grep commit objs | cut -c-40 | sort >actual_commits
+       grep commit objs | cut -d" " -f1 | sort >actual_commits
 }
 
 check_output () {
@@ -37,6 +37,7 @@ check_output () {
 #             \ | /
 #               a
 test_expect_success 'setup repository' '
+       test_oid_init &&
        test_commit a &&
        git checkout -b o/foo &&
        test_commit b &&
@@ -333,7 +334,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
        git -C "$REPO" config uploadpack.allowRefInWant false &&
        rm -rf local &&
        cp -r "$LOCAL_PRISTINE" local &&
-       inconsistency master 1234567890123456789012345678901234567890 &&
+       inconsistency master $(test_oid numeric) &&
        test_must_fail git -C local fetch 2>err &&
        test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
 '
@@ -342,7 +343,7 @@ test_expect_success 'server is initially ahead - ref in want' '
        git -C "$REPO" config uploadpack.allowRefInWant true &&
        rm -rf local &&
        cp -r "$LOCAL_PRISTINE" local &&
-       inconsistency master 1234567890123456789012345678901234567890 &&
+       inconsistency master $(test_oid numeric) &&
        git -C local fetch &&
 
        git -C "$REPO" rev-parse --verify master >expected &&