]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5537: make hash size independent
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 21 Dec 2019 19:49:32 +0000 (19:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jan 2020 22:06:19 +0000 (14:06 -0800)
This test modifies a pkt-line stream with sed to change a line with
"shallow" to "unshallow".  However, this modification is dependent on
the size of the hash in use; with SHA-256, the pkt-line length is
different, leading to the sed command having no effect.

Use test_oid_cache to specify the correct values for each hash so that
the test continues to work.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5537-fetch-shallow.sh

index 97a67728ca9b9a16f81fb278f44fd3412383c154..9e16512fe31b9bbb64c88093c5c317299a0e5735 100755 (executable)
@@ -15,7 +15,11 @@ test_expect_success 'setup' '
        commit 2 &&
        commit 3 &&
        commit 4 &&
-       git config --global transfer.fsckObjects true
+       git config --global transfer.fsckObjects true &&
+       test_oid_cache <<-EOF
+       sed sha1:s/0034shallow %s/0036unshallow %s/
+       sed sha256:s/004cshallow %s/004eunshallow %s/
+       EOF
 '
 
 test_expect_success 'setup shallow clone' '
@@ -239,7 +243,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
        # with an empty packfile. This is done by refetching with a shorter
        # depth (to ensure that the packfile is empty), and overwriting the
        # shallow line in the response with the unshallow line we want.
-       printf "s/0034shallow %s/0036unshallow %s/" \
+       printf "$(test_oid sed)" \
               "$(git -C "$REPO" rev-parse HEAD)" \
               "$(git -C "$REPO" rev-parse HEAD^)" \
               >"$HTTPD_ROOT_PATH/one-time-sed" &&