@matheusbsbs / matheus-bagliano / commits / a8c17e3bd6
Fork 0

t5537: make hash size independent

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>

brian m. carlson committed Dec 21, 2019 at 19:49 UTC a8c17e3bd6086bf3ed5c73fe610fc347ae494383
1 file changed +6 -2
t/t5537-fetch-shallow.sh
+6 -2
@@ -15,7 +15,11 @@ test_expect_success 'setup' '
15 commit 2 &&
16 commit 3 &&
17 commit 4 &&
18 - git config --global transfer.fsckObjects true
18 + git config --global transfer.fsckObjects true &&
19 + test_oid_cache <<-EOF
20 + sed sha1:s/0034shallow %s/0036unshallow %s/
21 + sed sha256:s/004cshallow %s/004eunshallow %s/
22 + EOF
23 '
24
25 test_expect_success 'setup shallow clone' '
@@ -239,7 +243,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
243 # with an empty packfile. This is done by refetching with a shorter
244 # depth (to ensure that the packfile is empty), and overwriting the
245 # shallow line in the response with the unshallow line we want.
242 - printf "s/0034shallow %s/0036unshallow %s/" \
246 + printf "$(test_oid sed)" \
247 "$(git -C "$REPO" rev-parse HEAD)" \
248 "$(git -C "$REPO" rev-parse HEAD^)" \
249 >"$HTTPD_ROOT_PATH/one-time-sed" &&