t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t5555-http-smart-common.sh
blobb1cfe8b7dba816ddcaee85c0a3e19d0c958e6cd5
1 #!/bin/sh
3 test_description='test functionality common to smart fetch & push'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup' '
9 test_commit --no-tag initial
12 test_expect_success 'git upload-pack --http-backend-info-refs and --advertise-refs are aliased' '
13 git upload-pack --http-backend-info-refs . >expected 2>err.expected &&
14 git upload-pack --advertise-refs . >actual 2>err.actual &&
15 test_cmp err.expected err.actual &&
16 test_cmp expected actual
19 test_expect_success 'git receive-pack --http-backend-info-refs and --advertise-refs are aliased' '
20 git receive-pack --http-backend-info-refs . >expected 2>err.expected &&
21 git receive-pack --advertise-refs . >actual 2>err.actual &&
22 test_cmp err.expected err.actual &&
23 test_cmp expected actual
26 test_expect_success 'git upload-pack --advertise-refs' '
27 cat >expect <<-EOF &&
28 $(git rev-parse HEAD) HEAD
29 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
30 0000
31 EOF
33 # We only care about GIT_PROTOCOL, not GIT_TEST_PROTOCOL_VERSION
34 sane_unset GIT_PROTOCOL &&
35 GIT_TEST_PROTOCOL_VERSION=2 \
36 git upload-pack --advertise-refs . >out 2>err &&
38 test-tool pkt-line unpack <out >actual &&
39 test_must_be_empty err &&
40 test_cmp actual expect &&
42 # The --advertise-refs alias works
43 git upload-pack --advertise-refs . >out 2>err &&
45 test-tool pkt-line unpack <out >actual &&
46 test_must_be_empty err &&
47 test_cmp actual expect
50 test_expect_success 'git upload-pack --advertise-refs: v0' '
51 # With no specified protocol
52 cat >expect <<-EOF &&
53 $(git rev-parse HEAD) HEAD
54 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
55 0000
56 EOF
58 git upload-pack --advertise-refs . >out 2>err &&
59 test-tool pkt-line unpack <out >actual &&
60 test_must_be_empty err &&
61 test_cmp actual expect &&
63 # With explicit v0
64 GIT_PROTOCOL=version=0 \
65 git upload-pack --advertise-refs . >out 2>err &&
66 test-tool pkt-line unpack <out >actual 2>err &&
67 test_must_be_empty err &&
68 test_cmp actual expect
72 test_expect_success 'git receive-pack --advertise-refs: v0' '
73 # With no specified protocol
74 cat >expect <<-EOF &&
75 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
76 0000
77 EOF
79 git receive-pack --advertise-refs . >out 2>err &&
80 test-tool pkt-line unpack <out >actual &&
81 test_must_be_empty err &&
82 test_cmp actual expect &&
84 # With explicit v0
85 GIT_PROTOCOL=version=0 \
86 git receive-pack --advertise-refs . >out 2>err &&
87 test-tool pkt-line unpack <out >actual 2>err &&
88 test_must_be_empty err &&
89 test_cmp actual expect
93 test_expect_success 'git upload-pack --advertise-refs: v1' '
94 # With no specified protocol
95 cat >expect <<-EOF &&
96 version 1
97 $(git rev-parse HEAD) HEAD
98 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
99 0000
102 GIT_PROTOCOL=version=1 \
103 git upload-pack --advertise-refs . >out &&
105 test-tool pkt-line unpack <out >actual 2>err &&
106 test_must_be_empty err &&
107 test_cmp actual expect
110 test_expect_success 'git receive-pack --advertise-refs: v1' '
111 # With no specified protocol
112 cat >expect <<-EOF &&
113 version 1
114 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
115 0000
118 GIT_PROTOCOL=version=1 \
119 git receive-pack --advertise-refs . >out &&
121 test-tool pkt-line unpack <out >actual 2>err &&
122 test_must_be_empty err &&
123 test_cmp actual expect
126 test_expect_success 'git upload-pack --advertise-refs: v2' '
127 cat >expect <<-EOF &&
128 version 2
129 agent=FAKE
130 ls-refs=unborn
131 fetch=shallow wait-for-done
132 server-option
133 object-format=$(test_oid algo)
134 object-info
135 0000
138 GIT_PROTOCOL=version=2 \
139 GIT_USER_AGENT=FAKE \
140 git upload-pack --advertise-refs . >out 2>err &&
142 test-tool pkt-line unpack <out >actual &&
143 test_must_be_empty err &&
144 test_cmp actual expect
147 test_expect_success 'git receive-pack --advertise-refs: v2' '
148 # There is no v2 yet for receive-pack, implicit v0
149 cat >expect <<-EOF &&
150 $(git rev-parse HEAD) $(git symbolic-ref HEAD)
151 0000
154 GIT_PROTOCOL=version=2 \
155 git receive-pack --advertise-refs . >out 2>err &&
157 test-tool pkt-line unpack <out >actual &&
158 test_must_be_empty err &&
159 test_cmp actual expect
162 test_done