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

t5703: use object-format serve option

When we're using an algorithm other than SHA-1, we need to specify the algorithm in use so we don't get a failure with an "unknown format" message. Add a wrapper function that specifies this header if required. Skip specifying this header for SHA-1 to test that it works both with an without this header. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jun 19, 2020 at 17:55 UTC f7c6a3bf080aae499e0aa0c69aa0d86423bd24f8
1 file changed +14 -5
t/t5703-upload-pack-ref-in-want.sh
+14 -5
@@ -27,6 +27,15 @@ check_output () {
27 test_cmp sorted_commits actual_commits
28 }
29
30 +write_command () {
31 + echo "command=$1"
32 +
33 + if test "$(test_oid algo)" != sha1
34 + then
35 + echo "object-format=$(test_oid algo)"
36 + fi
37 +}
38 +
39 # c(o/foo) d(o/bar)
40 # \ /
41 # b e(baz) f(master)
@@ -62,7 +71,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
71
72 test_expect_success 'invalid want-ref line' '
73 test-tool pkt-line pack >in <<-EOF &&
65 - command=fetch
74 + $(write_command fetch)
75 0001
76 no-progress
77 want-ref refs/heads/non-existent
@@ -83,7 +92,7 @@ test_expect_success 'basic want-ref' '
92
93 oid=$(git rev-parse a) &&
94 test-tool pkt-line pack >in <<-EOF &&
86 - command=fetch
95 + $(write_command fetch)
96 0001
97 no-progress
98 want-ref refs/heads/master
@@ -107,7 +116,7 @@ test_expect_success 'multiple want-ref lines' '
116
117 oid=$(git rev-parse b) &&
118 test-tool pkt-line pack >in <<-EOF &&
110 - command=fetch
119 + $(write_command fetch)
120 0001
121 no-progress
122 want-ref refs/heads/o/foo
@@ -129,7 +138,7 @@ test_expect_success 'mix want and want-ref' '
138 git rev-parse e f >expected_commits &&
139
140 test-tool pkt-line pack >in <<-EOF &&
132 - command=fetch
141 + $(write_command fetch)
142 0001
143 no-progress
144 want-ref refs/heads/master
@@ -152,7 +161,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
161
162 oid=$(git rev-parse c) &&
163 test-tool pkt-line pack >in <<-EOF &&
155 - command=fetch
164 + $(write_command fetch)
165 0001
166 no-progress
167 want-ref refs/heads/o/foo