Skip to content

Commit f7c6a3b

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8fc7003 commit f7c6a3b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

t/t5703-upload-pack-ref-in-want.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ check_output () {
2727
test_cmp sorted_commits actual_commits
2828
}
2929

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+
3039
# c(o/foo) d(o/bar)
3140
# \ /
3241
# b e(baz) f(master)
@@ -62,7 +71,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
6271

6372
test_expect_success 'invalid want-ref line' '
6473
test-tool pkt-line pack >in <<-EOF &&
65-
command=fetch
74+
$(write_command fetch)
6675
0001
6776
no-progress
6877
want-ref refs/heads/non-existent
@@ -83,7 +92,7 @@ test_expect_success 'basic want-ref' '
8392
8493
oid=$(git rev-parse a) &&
8594
test-tool pkt-line pack >in <<-EOF &&
86-
command=fetch
95+
$(write_command fetch)
8796
0001
8897
no-progress
8998
want-ref refs/heads/master
@@ -107,7 +116,7 @@ test_expect_success 'multiple want-ref lines' '
107116
108117
oid=$(git rev-parse b) &&
109118
test-tool pkt-line pack >in <<-EOF &&
110-
command=fetch
119+
$(write_command fetch)
111120
0001
112121
no-progress
113122
want-ref refs/heads/o/foo
@@ -129,7 +138,7 @@ test_expect_success 'mix want and want-ref' '
129138
git rev-parse e f >expected_commits &&
130139
131140
test-tool pkt-line pack >in <<-EOF &&
132-
command=fetch
141+
$(write_command fetch)
133142
0001
134143
no-progress
135144
want-ref refs/heads/master
@@ -152,7 +161,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
152161
153162
oid=$(git rev-parse c) &&
154163
test-tool pkt-line pack >in <<-EOF &&
155-
command=fetch
164+
$(write_command fetch)
156165
0001
157166
no-progress
158167
want-ref refs/heads/o/foo

0 commit comments

Comments
 (0)