]>
Commit | Line | Data |
---|---|---|
bcdb34f7 JH |
1 | #!/bin/sh |
2 | ||
2ead7a67 RR |
3 | test_description='Basic fetch/push functionality. |
4 | ||
5 | This test checks the following functionality: | |
6 | ||
7 | * command-line syntax | |
8 | * refspecs | |
9 | * fast-forward detection, and overriding it | |
10 | * configuration | |
11 | * hooks | |
12 | * --porcelain output format | |
13 | * hiderefs | |
72549dfd | 14 | * reflogs |
2ead7a67 | 15 | ' |
bcdb34f7 JH |
16 | |
17 | . ./test-lib.sh | |
18 | ||
bf45242b | 19 | D=$(pwd) |
bcdb34f7 JH |
20 | |
21 | mk_empty () { | |
2e433b78 JK |
22 | repo_name="$1" |
23 | rm -fr "$repo_name" && | |
24 | mkdir "$repo_name" && | |
bcdb34f7 | 25 | ( |
2e433b78 | 26 | cd "$repo_name" && |
586e4ce2 | 27 | git init && |
acd2a45b | 28 | git config receive.denyCurrentBranch warn && |
586e4ce2 | 29 | mv .git/hooks .git/hooks-disabled |
bcdb34f7 JH |
30 | ) |
31 | } | |
32 | ||
6125796f | 33 | mk_test () { |
2e433b78 JK |
34 | repo_name="$1" |
35 | shift | |
36 | ||
37 | mk_empty "$repo_name" && | |
6125796f JH |
38 | ( |
39 | for ref in "$@" | |
40 | do | |
2e433b78 | 41 | git push "$repo_name" $the_first_commit:refs/$ref || |
5bd81c73 | 42 | exit |
6125796f | 43 | done && |
2e433b78 | 44 | cd "$repo_name" && |
6125796f JH |
45 | for ref in "$@" |
46 | do | |
848575d8 JN |
47 | echo "$the_first_commit" >expect && |
48 | git show-ref -s --verify refs/$ref >actual && | |
49 | test_cmp expect actual || | |
50 | exit | |
6125796f JH |
51 | done && |
52 | git fsck --full | |
53 | ) | |
54 | } | |
55 | ||
160b81ed | 56 | mk_test_with_hooks() { |
2e433b78 | 57 | repo_name=$1 |
160b81ed PYH |
58 | mk_test "$@" && |
59 | ( | |
2e433b78 | 60 | cd "$repo_name" && |
160b81ed PYH |
61 | mkdir .git/hooks && |
62 | cd .git/hooks && | |
63 | ||
64 | cat >pre-receive <<-'EOF' && | |
65 | #!/bin/sh | |
66 | cat - >>pre-receive.actual | |
67 | EOF | |
68 | ||
69 | cat >update <<-'EOF' && | |
70 | #!/bin/sh | |
71 | printf "%s %s %s\n" "$@" >>update.actual | |
72 | EOF | |
73 | ||
74 | cat >post-receive <<-'EOF' && | |
75 | #!/bin/sh | |
76 | cat - >>post-receive.actual | |
77 | EOF | |
78 | ||
79 | cat >post-update <<-'EOF' && | |
80 | #!/bin/sh | |
81 | for ref in "$@" | |
82 | do | |
83 | printf "%s\n" "$ref" >>post-update.actual | |
84 | done | |
85 | EOF | |
86 | ||
87 | chmod +x pre-receive update post-receive post-update | |
88 | ) | |
89 | } | |
90 | ||
b2dc968e | 91 | mk_child() { |
2e433b78 JK |
92 | rm -rf "$2" && |
93 | git clone "$1" "$2" | |
b2dc968e JK |
94 | } |
95 | ||
6125796f | 96 | check_push_result () { |
2e433b78 JK |
97 | repo_name="$1" |
98 | shift | |
99 | ||
6125796f | 100 | ( |
2e433b78 | 101 | cd "$repo_name" && |
848575d8 JN |
102 | echo "$1" >expect && |
103 | shift && | |
6125796f JH |
104 | for ref in "$@" |
105 | do | |
848575d8 JN |
106 | git show-ref -s --verify refs/$ref >actual && |
107 | test_cmp expect actual || | |
108 | exit | |
6125796f JH |
109 | done && |
110 | git fsck --full | |
111 | ) | |
112 | } | |
113 | ||
bcdb34f7 JH |
114 | test_expect_success setup ' |
115 | ||
d4785cd1 | 116 | >path1 && |
bcdb34f7 JH |
117 | git add path1 && |
118 | test_tick && | |
119 | git commit -a -m repo && | |
6125796f JH |
120 | the_first_commit=$(git show-ref -s --verify refs/heads/master) && |
121 | ||
d4785cd1 | 122 | >path2 && |
6125796f JH |
123 | git add path2 && |
124 | test_tick && | |
125 | git commit -a -m second && | |
bcdb34f7 JH |
126 | the_commit=$(git show-ref -s --verify refs/heads/master) |
127 | ||
128 | ' | |
129 | ||
130 | test_expect_success 'fetch without wildcard' ' | |
2e433b78 | 131 | mk_empty testrepo && |
bcdb34f7 JH |
132 | ( |
133 | cd testrepo && | |
134 | git fetch .. refs/heads/master:refs/remotes/origin/master && | |
135 | ||
848575d8 JN |
136 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
137 | git for-each-ref refs/remotes/origin >actual && | |
138 | test_cmp expect actual | |
bcdb34f7 JH |
139 | ) |
140 | ' | |
141 | ||
142 | test_expect_success 'fetch with wildcard' ' | |
2e433b78 | 143 | mk_empty testrepo && |
bcdb34f7 JH |
144 | ( |
145 | cd testrepo && | |
146 | git config remote.up.url .. && | |
147 | git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" && | |
148 | git fetch up && | |
149 | ||
848575d8 JN |
150 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
151 | git for-each-ref refs/remotes/origin >actual && | |
152 | test_cmp expect actual | |
bcdb34f7 JH |
153 | ) |
154 | ' | |
155 | ||
55029ae4 | 156 | test_expect_success 'fetch with insteadOf' ' |
2e433b78 | 157 | mk_empty testrepo && |
55029ae4 | 158 | ( |
60e3aba9 | 159 | TRASH=$(pwd)/ && |
55029ae4 | 160 | cd testrepo && |
f69e836f | 161 | git config "url.$TRASH.insteadOf" trash/ && |
55029ae4 DB |
162 | git config remote.up.url trash/. && |
163 | git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" && | |
164 | git fetch up && | |
165 | ||
848575d8 JN |
166 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
167 | git for-each-ref refs/remotes/origin >actual && | |
168 | test_cmp expect actual | |
55029ae4 DB |
169 | ) |
170 | ' | |
171 | ||
1c2eafb8 | 172 | test_expect_success 'fetch with pushInsteadOf (should not rewrite)' ' |
2e433b78 | 173 | mk_empty testrepo && |
1c2eafb8 JT |
174 | ( |
175 | TRASH=$(pwd)/ && | |
176 | cd testrepo && | |
177 | git config "url.trash/.pushInsteadOf" "$TRASH" && | |
178 | git config remote.up.url "$TRASH." && | |
179 | git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" && | |
180 | git fetch up && | |
181 | ||
848575d8 JN |
182 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
183 | git for-each-ref refs/remotes/origin >actual && | |
184 | test_cmp expect actual | |
1c2eafb8 JT |
185 | ) |
186 | ' | |
187 | ||
bcdb34f7 | 188 | test_expect_success 'push without wildcard' ' |
2e433b78 | 189 | mk_empty testrepo && |
bcdb34f7 JH |
190 | |
191 | git push testrepo refs/heads/master:refs/remotes/origin/master && | |
192 | ( | |
193 | cd testrepo && | |
848575d8 JN |
194 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
195 | git for-each-ref refs/remotes/origin >actual && | |
196 | test_cmp expect actual | |
bcdb34f7 JH |
197 | ) |
198 | ' | |
199 | ||
200 | test_expect_success 'push with wildcard' ' | |
2e433b78 | 201 | mk_empty testrepo && |
bcdb34f7 JH |
202 | |
203 | git push testrepo "refs/heads/*:refs/remotes/origin/*" && | |
204 | ( | |
205 | cd testrepo && | |
848575d8 JN |
206 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
207 | git for-each-ref refs/remotes/origin >actual && | |
208 | test_cmp expect actual | |
bcdb34f7 JH |
209 | ) |
210 | ' | |
211 | ||
55029ae4 | 212 | test_expect_success 'push with insteadOf' ' |
2e433b78 | 213 | mk_empty testrepo && |
f69e836f | 214 | TRASH="$(pwd)/" && |
3c695523 | 215 | test_config "url.$TRASH.insteadOf" trash/ && |
55029ae4 DB |
216 | git push trash/testrepo refs/heads/master:refs/remotes/origin/master && |
217 | ( | |
218 | cd testrepo && | |
848575d8 JN |
219 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
220 | git for-each-ref refs/remotes/origin >actual && | |
221 | test_cmp expect actual | |
55029ae4 DB |
222 | ) |
223 | ' | |
224 | ||
1c2eafb8 | 225 | test_expect_success 'push with pushInsteadOf' ' |
2e433b78 | 226 | mk_empty testrepo && |
1c2eafb8 | 227 | TRASH="$(pwd)/" && |
3c695523 | 228 | test_config "url.$TRASH.pushInsteadOf" trash/ && |
1c2eafb8 JT |
229 | git push trash/testrepo refs/heads/master:refs/remotes/origin/master && |
230 | ( | |
231 | cd testrepo && | |
848575d8 JN |
232 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
233 | git for-each-ref refs/remotes/origin >actual && | |
234 | test_cmp expect actual | |
1c2eafb8 JT |
235 | ) |
236 | ' | |
237 | ||
238 | test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' ' | |
2e433b78 | 239 | mk_empty testrepo && |
41ae34d1 | 240 | test_config "url.trash2/.pushInsteadOf" testrepo/ && |
eb32c66e | 241 | test_config "url.trash3/.pushInsteadOf" trash/wrong && |
3c695523 | 242 | test_config remote.r.url trash/wrong && |
41ae34d1 | 243 | test_config remote.r.pushurl "testrepo/" && |
1c2eafb8 JT |
244 | git push r refs/heads/master:refs/remotes/origin/master && |
245 | ( | |
246 | cd testrepo && | |
848575d8 JN |
247 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
248 | git for-each-ref refs/remotes/origin >actual && | |
249 | test_cmp expect actual | |
1c2eafb8 JT |
250 | ) |
251 | ' | |
252 | ||
6125796f JH |
253 | test_expect_success 'push with matching heads' ' |
254 | ||
2e433b78 | 255 | mk_test testrepo heads/master && |
0a42ac03 | 256 | git push testrepo : && |
2e433b78 | 257 | check_push_result testrepo $the_commit heads/master |
6125796f JH |
258 | |
259 | ' | |
260 | ||
a83619d6 PB |
261 | test_expect_success 'push with matching heads on the command line' ' |
262 | ||
2e433b78 | 263 | mk_test testrepo heads/master && |
a83619d6 | 264 | git push testrepo : && |
2e433b78 | 265 | check_push_result testrepo $the_commit heads/master |
a83619d6 PB |
266 | |
267 | ' | |
268 | ||
269 | test_expect_success 'failed (non-fast-forward) push with matching heads' ' | |
270 | ||
2e433b78 | 271 | mk_test testrepo heads/master && |
a83619d6 PB |
272 | git push testrepo : && |
273 | git commit --amend -massaged && | |
d492b31c | 274 | test_must_fail git push testrepo && |
2e433b78 | 275 | check_push_result testrepo $the_commit heads/master && |
a83619d6 PB |
276 | git reset --hard $the_commit |
277 | ||
278 | ' | |
279 | ||
280 | test_expect_success 'push --force with matching heads' ' | |
281 | ||
2e433b78 | 282 | mk_test testrepo heads/master && |
a83619d6 PB |
283 | git push testrepo : && |
284 | git commit --amend -massaged && | |
0a42ac03 | 285 | git push --force testrepo : && |
2e433b78 | 286 | ! check_push_result testrepo $the_commit heads/master && |
a83619d6 PB |
287 | git reset --hard $the_commit |
288 | ||
289 | ' | |
290 | ||
291 | test_expect_success 'push with matching heads and forced update' ' | |
292 | ||
2e433b78 | 293 | mk_test testrepo heads/master && |
a83619d6 PB |
294 | git push testrepo : && |
295 | git commit --amend -massaged && | |
296 | git push testrepo +: && | |
2e433b78 | 297 | ! check_push_result testrepo $the_commit heads/master && |
a83619d6 PB |
298 | git reset --hard $the_commit |
299 | ||
300 | ' | |
301 | ||
6125796f JH |
302 | test_expect_success 'push with no ambiguity (1)' ' |
303 | ||
2e433b78 | 304 | mk_test testrepo heads/master && |
6125796f | 305 | git push testrepo master:master && |
2e433b78 | 306 | check_push_result testrepo $the_commit heads/master |
6125796f JH |
307 | |
308 | ' | |
309 | ||
310 | test_expect_success 'push with no ambiguity (2)' ' | |
311 | ||
2e433b78 | 312 | mk_test testrepo remotes/origin/master && |
ae36bdcf | 313 | git push testrepo master:origin/master && |
2e433b78 | 314 | check_push_result testrepo $the_commit remotes/origin/master |
6125796f JH |
315 | |
316 | ' | |
317 | ||
ae36bdcf SP |
318 | test_expect_success 'push with colon-less refspec, no ambiguity' ' |
319 | ||
2e433b78 | 320 | mk_test testrepo heads/master heads/t/master && |
ae36bdcf SP |
321 | git branch -f t/master master && |
322 | git push testrepo master && | |
2e433b78 JK |
323 | check_push_result testrepo $the_commit heads/master && |
324 | check_push_result testrepo $the_first_commit heads/t/master | |
ae36bdcf SP |
325 | |
326 | ' | |
327 | ||
6125796f JH |
328 | test_expect_success 'push with weak ambiguity (1)' ' |
329 | ||
2e433b78 | 330 | mk_test testrepo heads/master remotes/origin/master && |
6125796f | 331 | git push testrepo master:master && |
2e433b78 JK |
332 | check_push_result testrepo $the_commit heads/master && |
333 | check_push_result testrepo $the_first_commit remotes/origin/master | |
6125796f JH |
334 | |
335 | ' | |
336 | ||
337 | test_expect_success 'push with weak ambiguity (2)' ' | |
338 | ||
2e433b78 | 339 | mk_test testrepo heads/master remotes/origin/master remotes/another/master && |
6125796f | 340 | git push testrepo master:master && |
2e433b78 JK |
341 | check_push_result testrepo $the_commit heads/master && |
342 | check_push_result testrepo $the_first_commit remotes/origin/master remotes/another/master | |
6125796f JH |
343 | |
344 | ' | |
345 | ||
3ef6a1fe | 346 | test_expect_success 'push with ambiguity' ' |
6125796f | 347 | |
2e433b78 | 348 | mk_test testrepo heads/frotz tags/frotz && |
5bd81c73 | 349 | test_must_fail git push testrepo master:frotz && |
2e433b78 | 350 | check_push_result testrepo $the_first_commit heads/frotz tags/frotz |
1ed10b88 JH |
351 | |
352 | ' | |
353 | ||
354 | test_expect_success 'push with colon-less refspec (1)' ' | |
355 | ||
2e433b78 | 356 | mk_test testrepo heads/frotz tags/frotz && |
1ed10b88 JH |
357 | git branch -f frotz master && |
358 | git push testrepo frotz && | |
2e433b78 JK |
359 | check_push_result testrepo $the_commit heads/frotz && |
360 | check_push_result testrepo $the_first_commit tags/frotz | |
1ed10b88 JH |
361 | |
362 | ' | |
363 | ||
364 | test_expect_success 'push with colon-less refspec (2)' ' | |
365 | ||
2e433b78 | 366 | mk_test testrepo heads/frotz tags/frotz && |
1ed10b88 JH |
367 | if git show-ref --verify -q refs/heads/frotz |
368 | then | |
369 | git branch -D frotz | |
370 | fi && | |
371 | git tag -f frotz && | |
dbfeddb1 | 372 | git push -f testrepo frotz && |
2e433b78 JK |
373 | check_push_result testrepo $the_commit tags/frotz && |
374 | check_push_result testrepo $the_first_commit heads/frotz | |
1ed10b88 JH |
375 | |
376 | ' | |
377 | ||
378 | test_expect_success 'push with colon-less refspec (3)' ' | |
379 | ||
2e433b78 | 380 | mk_test testrepo && |
1ed10b88 JH |
381 | if git show-ref --verify -q refs/tags/frotz |
382 | then | |
383 | git tag -d frotz | |
384 | fi && | |
385 | git branch -f frotz master && | |
386 | git push testrepo frotz && | |
2e433b78 | 387 | check_push_result testrepo $the_commit heads/frotz && |
9a3c6f7b | 388 | test 1 = $( cd testrepo && git show-ref | wc -l ) |
1ed10b88 JH |
389 | ' |
390 | ||
391 | test_expect_success 'push with colon-less refspec (4)' ' | |
392 | ||
2e433b78 | 393 | mk_test testrepo && |
1ed10b88 JH |
394 | if git show-ref --verify -q refs/heads/frotz |
395 | then | |
396 | git branch -D frotz | |
397 | fi && | |
398 | git tag -f frotz && | |
399 | git push testrepo frotz && | |
2e433b78 | 400 | check_push_result testrepo $the_commit tags/frotz && |
9a3c6f7b | 401 | test 1 = $( cd testrepo && git show-ref | wc -l ) |
1ed10b88 | 402 | |
6125796f JH |
403 | ' |
404 | ||
7be8b3ba | 405 | test_expect_success 'push head with non-existent, incomplete dest' ' |
f8aae120 | 406 | |
2e433b78 | 407 | mk_test testrepo && |
f8aae120 | 408 | git push testrepo master:branch && |
2e433b78 | 409 | check_push_result testrepo $the_commit heads/branch |
f8aae120 JK |
410 | |
411 | ' | |
412 | ||
7be8b3ba | 413 | test_expect_success 'push tag with non-existent, incomplete dest' ' |
f8aae120 | 414 | |
2e433b78 | 415 | mk_test testrepo && |
f8aae120 JK |
416 | git tag -f v1.0 && |
417 | git push testrepo v1.0:tag && | |
2e433b78 | 418 | check_push_result testrepo $the_commit tags/tag |
f8aae120 JK |
419 | |
420 | ' | |
421 | ||
7be8b3ba | 422 | test_expect_success 'push sha1 with non-existent, incomplete dest' ' |
f8aae120 | 423 | |
2e433b78 | 424 | mk_test testrepo && |
bf45242b | 425 | test_must_fail git push testrepo $(git rev-parse master):foo |
f8aae120 JK |
426 | |
427 | ' | |
428 | ||
7be8b3ba | 429 | test_expect_success 'push ref expression with non-existent, incomplete dest' ' |
f8aae120 | 430 | |
2e433b78 | 431 | mk_test testrepo && |
f8aae120 JK |
432 | test_must_fail git push testrepo master^:branch |
433 | ||
434 | ' | |
435 | ||
47d996a2 SP |
436 | test_expect_success 'push with HEAD' ' |
437 | ||
2e433b78 | 438 | mk_test testrepo heads/master && |
47d996a2 SP |
439 | git checkout master && |
440 | git push testrepo HEAD && | |
2e433b78 | 441 | check_push_result testrepo $the_commit heads/master |
47d996a2 SP |
442 | |
443 | ' | |
444 | ||
445 | test_expect_success 'push with HEAD nonexisting at remote' ' | |
446 | ||
2e433b78 | 447 | mk_test testrepo heads/master && |
47d996a2 SP |
448 | git checkout -b local master && |
449 | git push testrepo HEAD && | |
2e433b78 | 450 | check_push_result testrepo $the_commit heads/local |
47d996a2 SP |
451 | ' |
452 | ||
9f0ea7e8 DB |
453 | test_expect_success 'push with +HEAD' ' |
454 | ||
2e433b78 | 455 | mk_test testrepo heads/master && |
9f0ea7e8 DB |
456 | git checkout master && |
457 | git branch -D local && | |
458 | git checkout -b local && | |
459 | git push testrepo master local && | |
2e433b78 JK |
460 | check_push_result testrepo $the_commit heads/master && |
461 | check_push_result testrepo $the_commit heads/local && | |
9f0ea7e8 DB |
462 | |
463 | # Without force rewinding should fail | |
464 | git reset --hard HEAD^ && | |
d492b31c | 465 | test_must_fail git push testrepo HEAD && |
2e433b78 | 466 | check_push_result testrepo $the_commit heads/local && |
9f0ea7e8 DB |
467 | |
468 | # With force rewinding should succeed | |
469 | git push testrepo +HEAD && | |
2e433b78 | 470 | check_push_result testrepo $the_first_commit heads/local |
9f0ea7e8 DB |
471 | |
472 | ' | |
473 | ||
7be8b3ba | 474 | test_expect_success 'push HEAD with non-existent, incomplete dest' ' |
f8aae120 | 475 | |
2e433b78 | 476 | mk_test testrepo && |
f8aae120 JK |
477 | git checkout master && |
478 | git push testrepo HEAD:branch && | |
2e433b78 | 479 | check_push_result testrepo $the_commit heads/branch |
f8aae120 JK |
480 | |
481 | ' | |
482 | ||
9f0ea7e8 DB |
483 | test_expect_success 'push with config remote.*.push = HEAD' ' |
484 | ||
2e433b78 | 485 | mk_test testrepo heads/local && |
9f0ea7e8 DB |
486 | git checkout master && |
487 | git branch -f local $the_commit && | |
488 | ( | |
489 | cd testrepo && | |
490 | git checkout local && | |
491 | git reset --hard $the_first_commit | |
492 | ) && | |
3c695523 JN |
493 | test_config remote.there.url testrepo && |
494 | test_config remote.there.push HEAD && | |
495 | test_config branch.master.remote there && | |
9f0ea7e8 | 496 | git push && |
2e433b78 JK |
497 | check_push_result testrepo $the_commit heads/master && |
498 | check_push_result testrepo $the_first_commit heads/local | |
9f0ea7e8 DB |
499 | ' |
500 | ||
224c2171 RR |
501 | test_expect_success 'push with remote.pushdefault' ' |
502 | mk_test up_repo heads/master && | |
503 | mk_test down_repo heads/master && | |
504 | test_config remote.up.url up_repo && | |
505 | test_config remote.down.url down_repo && | |
506 | test_config branch.master.remote up && | |
507 | test_config remote.pushdefault down && | |
54a3c673 | 508 | test_config push.default matching && |
224c2171 RR |
509 | git push && |
510 | check_push_result up_repo $the_first_commit heads/master && | |
511 | check_push_result down_repo $the_commit heads/master | |
9f0ea7e8 DB |
512 | ' |
513 | ||
e1ca4241 MG |
514 | test_expect_success 'push with config remote.*.pushurl' ' |
515 | ||
2e433b78 | 516 | mk_test testrepo heads/master && |
e1ca4241 | 517 | git checkout master && |
3c695523 JN |
518 | test_config remote.there.url test2repo && |
519 | test_config remote.there.pushurl testrepo && | |
0a42ac03 | 520 | git push there : && |
2e433b78 | 521 | check_push_result testrepo $the_commit heads/master |
e1ca4241 MG |
522 | ' |
523 | ||
9f765ce6 RR |
524 | test_expect_success 'push with config branch.*.pushremote' ' |
525 | mk_test up_repo heads/master && | |
526 | mk_test side_repo heads/master && | |
527 | mk_test down_repo heads/master && | |
528 | test_config remote.up.url up_repo && | |
529 | test_config remote.pushdefault side_repo && | |
530 | test_config remote.down.url down_repo && | |
531 | test_config branch.master.remote up && | |
532 | test_config branch.master.pushremote down && | |
54a3c673 | 533 | test_config push.default matching && |
9f765ce6 RR |
534 | git push && |
535 | check_push_result up_repo $the_first_commit heads/master && | |
536 | check_push_result side_repo $the_first_commit heads/master && | |
537 | check_push_result down_repo $the_commit heads/master | |
e1ca4241 MG |
538 | ' |
539 | ||
98b406f3 JK |
540 | test_expect_success 'branch.*.pushremote config order is irrelevant' ' |
541 | mk_test one_repo heads/master && | |
542 | mk_test two_repo heads/master && | |
543 | test_config remote.one.url one_repo && | |
544 | test_config remote.two.url two_repo && | |
545 | test_config branch.master.pushremote two_repo && | |
546 | test_config remote.pushdefault one_repo && | |
547 | test_config push.default matching && | |
548 | git push && | |
549 | check_push_result one_repo $the_first_commit heads/master && | |
550 | check_push_result two_repo $the_commit heads/master | |
551 | ' | |
552 | ||
11f2441f BE |
553 | test_expect_success 'push with dry-run' ' |
554 | ||
2e433b78 | 555 | mk_test testrepo heads/master && |
d4785cd1 JS |
556 | ( |
557 | cd testrepo && | |
558 | old_commit=$(git show-ref -s --verify refs/heads/master) | |
559 | ) && | |
0a42ac03 | 560 | git push --dry-run testrepo : && |
2e433b78 | 561 | check_push_result testrepo $old_commit heads/master |
11f2441f BE |
562 | ' |
563 | ||
28391a80 JS |
564 | test_expect_success 'push updates local refs' ' |
565 | ||
2e433b78 JK |
566 | mk_test testrepo heads/master && |
567 | mk_child testrepo child && | |
d4785cd1 JS |
568 | ( |
569 | cd child && | |
b2dc968e | 570 | git pull .. master && |
28391a80 | 571 | git push && |
d4785cd1 JS |
572 | test $(git rev-parse master) = \ |
573 | $(git rev-parse remotes/origin/master) | |
574 | ) | |
28391a80 JS |
575 | |
576 | ' | |
577 | ||
16ed2f48 CB |
578 | test_expect_success 'push updates up-to-date local refs' ' |
579 | ||
2e433b78 JK |
580 | mk_test testrepo heads/master && |
581 | mk_child testrepo child1 && | |
582 | mk_child testrepo child2 && | |
b2dc968e | 583 | (cd child1 && git pull .. master && git push) && |
d4785cd1 JS |
584 | ( |
585 | cd child2 && | |
16ed2f48 CB |
586 | git pull ../child1 master && |
587 | git push && | |
d4785cd1 JS |
588 | test $(git rev-parse master) = \ |
589 | $(git rev-parse remotes/origin/master) | |
590 | ) | |
16ed2f48 CB |
591 | |
592 | ' | |
593 | ||
594 | test_expect_success 'push preserves up-to-date packed refs' ' | |
595 | ||
2e433b78 JK |
596 | mk_test testrepo heads/master && |
597 | mk_child testrepo child && | |
d4785cd1 JS |
598 | ( |
599 | cd child && | |
16ed2f48 | 600 | git push && |
d4785cd1 JS |
601 | ! test -f .git/refs/remotes/origin/master |
602 | ) | |
16ed2f48 CB |
603 | |
604 | ' | |
605 | ||
28391a80 JS |
606 | test_expect_success 'push does not update local refs on failure' ' |
607 | ||
2e433b78 JK |
608 | mk_test testrepo heads/master && |
609 | mk_child testrepo child && | |
b2dc968e | 610 | mkdir testrepo/.git/hooks && |
fc012c28 | 611 | echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive && |
b2dc968e | 612 | chmod +x testrepo/.git/hooks/pre-receive && |
d4785cd1 JS |
613 | ( |
614 | cd child && | |
b2dc968e | 615 | git pull .. master |
d492b31c | 616 | test_must_fail git push && |
28391a80 | 617 | test $(git rev-parse master) != \ |
d4785cd1 JS |
618 | $(git rev-parse remotes/origin/master) |
619 | ) | |
28391a80 JS |
620 | |
621 | ' | |
622 | ||
623 | test_expect_success 'allow deleting an invalid remote ref' ' | |
624 | ||
2e433b78 | 625 | mk_test testrepo heads/master && |
28391a80 JS |
626 | rm -f testrepo/.git/objects/??/* && |
627 | git push testrepo :refs/heads/master && | |
d492b31c | 628 | (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master) |
28391a80 JS |
629 | |
630 | ' | |
631 | ||
160b81ed | 632 | test_expect_success 'pushing valid refs triggers post-receive and post-update hooks' ' |
2e433b78 | 633 | mk_test_with_hooks testrepo heads/master heads/next && |
160b81ed PYH |
634 | orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) && |
635 | newmaster=$(git show-ref -s --verify refs/heads/master) && | |
636 | orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) && | |
637 | newnext=$_z40 && | |
638 | git push testrepo refs/heads/master:refs/heads/master :refs/heads/next && | |
639 | ( | |
640 | cd testrepo/.git && | |
641 | cat >pre-receive.expect <<-EOF && | |
642 | $orgmaster $newmaster refs/heads/master | |
643 | $orgnext $newnext refs/heads/next | |
644 | EOF | |
645 | ||
646 | cat >update.expect <<-EOF && | |
647 | refs/heads/master $orgmaster $newmaster | |
648 | refs/heads/next $orgnext $newnext | |
649 | EOF | |
650 | ||
651 | cat >post-receive.expect <<-EOF && | |
652 | $orgmaster $newmaster refs/heads/master | |
653 | $orgnext $newnext refs/heads/next | |
654 | EOF | |
655 | ||
656 | cat >post-update.expect <<-EOF && | |
657 | refs/heads/master | |
658 | refs/heads/next | |
659 | EOF | |
660 | ||
661 | test_cmp pre-receive.expect pre-receive.actual && | |
662 | test_cmp update.expect update.actual && | |
663 | test_cmp post-receive.expect post-receive.actual && | |
664 | test_cmp post-update.expect post-update.actual | |
665 | ) | |
666 | ' | |
667 | ||
668 | test_expect_success 'deleting dangling ref triggers hooks with correct args' ' | |
2e433b78 | 669 | mk_test_with_hooks testrepo heads/master && |
160b81ed PYH |
670 | rm -f testrepo/.git/objects/??/* && |
671 | git push testrepo :refs/heads/master && | |
672 | ( | |
673 | cd testrepo/.git && | |
674 | cat >pre-receive.expect <<-EOF && | |
675 | $_z40 $_z40 refs/heads/master | |
676 | EOF | |
677 | ||
678 | cat >update.expect <<-EOF && | |
679 | refs/heads/master $_z40 $_z40 | |
680 | EOF | |
681 | ||
682 | cat >post-receive.expect <<-EOF && | |
683 | $_z40 $_z40 refs/heads/master | |
684 | EOF | |
685 | ||
686 | cat >post-update.expect <<-EOF && | |
687 | refs/heads/master | |
688 | EOF | |
689 | ||
690 | test_cmp pre-receive.expect pre-receive.actual && | |
691 | test_cmp update.expect update.actual && | |
692 | test_cmp post-receive.expect post-receive.actual && | |
693 | test_cmp post-update.expect post-update.actual | |
694 | ) | |
695 | ' | |
696 | ||
697 | test_expect_success 'deletion of a non-existent ref is not fed to post-receive and post-update hooks' ' | |
2e433b78 | 698 | mk_test_with_hooks testrepo heads/master && |
160b81ed PYH |
699 | orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) && |
700 | newmaster=$(git show-ref -s --verify refs/heads/master) && | |
701 | git push testrepo master :refs/heads/nonexistent && | |
702 | ( | |
703 | cd testrepo/.git && | |
704 | cat >pre-receive.expect <<-EOF && | |
705 | $orgmaster $newmaster refs/heads/master | |
706 | $_z40 $_z40 refs/heads/nonexistent | |
707 | EOF | |
708 | ||
709 | cat >update.expect <<-EOF && | |
710 | refs/heads/master $orgmaster $newmaster | |
711 | refs/heads/nonexistent $_z40 $_z40 | |
712 | EOF | |
713 | ||
714 | cat >post-receive.expect <<-EOF && | |
715 | $orgmaster $newmaster refs/heads/master | |
716 | EOF | |
717 | ||
718 | cat >post-update.expect <<-EOF && | |
719 | refs/heads/master | |
720 | EOF | |
721 | ||
722 | test_cmp pre-receive.expect pre-receive.actual && | |
723 | test_cmp update.expect update.actual && | |
724 | test_cmp post-receive.expect post-receive.actual && | |
725 | test_cmp post-update.expect post-update.actual | |
726 | ) | |
727 | ' | |
728 | ||
729 | test_expect_success 'deletion of a non-existent ref alone does trigger post-receive and post-update hooks' ' | |
2e433b78 | 730 | mk_test_with_hooks testrepo heads/master && |
160b81ed PYH |
731 | git push testrepo :refs/heads/nonexistent && |
732 | ( | |
733 | cd testrepo/.git && | |
734 | cat >pre-receive.expect <<-EOF && | |
735 | $_z40 $_z40 refs/heads/nonexistent | |
736 | EOF | |
737 | ||
738 | cat >update.expect <<-EOF && | |
739 | refs/heads/nonexistent $_z40 $_z40 | |
740 | EOF | |
741 | ||
742 | test_cmp pre-receive.expect pre-receive.actual && | |
743 | test_cmp update.expect update.actual && | |
744 | test_path_is_missing post-receive.actual && | |
745 | test_path_is_missing post-update.actual | |
746 | ) | |
747 | ' | |
748 | ||
749 | test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks with correct input' ' | |
2e433b78 | 750 | mk_test_with_hooks testrepo heads/master heads/next heads/pu && |
160b81ed PYH |
751 | orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) && |
752 | newmaster=$(git show-ref -s --verify refs/heads/master) && | |
753 | orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) && | |
754 | newnext=$_z40 && | |
755 | orgpu=$(cd testrepo && git show-ref -s --verify refs/heads/pu) && | |
756 | newpu=$(git show-ref -s --verify refs/heads/master) && | |
757 | git push testrepo refs/heads/master:refs/heads/master \ | |
758 | refs/heads/master:refs/heads/pu :refs/heads/next \ | |
759 | :refs/heads/nonexistent && | |
760 | ( | |
761 | cd testrepo/.git && | |
762 | cat >pre-receive.expect <<-EOF && | |
763 | $orgmaster $newmaster refs/heads/master | |
764 | $orgnext $newnext refs/heads/next | |
765 | $orgpu $newpu refs/heads/pu | |
766 | $_z40 $_z40 refs/heads/nonexistent | |
767 | EOF | |
768 | ||
769 | cat >update.expect <<-EOF && | |
770 | refs/heads/master $orgmaster $newmaster | |
771 | refs/heads/next $orgnext $newnext | |
772 | refs/heads/pu $orgpu $newpu | |
773 | refs/heads/nonexistent $_z40 $_z40 | |
774 | EOF | |
775 | ||
776 | cat >post-receive.expect <<-EOF && | |
777 | $orgmaster $newmaster refs/heads/master | |
778 | $orgnext $newnext refs/heads/next | |
779 | $orgpu $newpu refs/heads/pu | |
780 | EOF | |
781 | ||
782 | cat >post-update.expect <<-EOF && | |
783 | refs/heads/master | |
784 | refs/heads/next | |
785 | refs/heads/pu | |
786 | EOF | |
787 | ||
788 | test_cmp pre-receive.expect pre-receive.actual && | |
789 | test_cmp update.expect update.actual && | |
790 | test_cmp post-receive.expect post-receive.actual && | |
791 | test_cmp post-update.expect post-update.actual | |
792 | ) | |
793 | ' | |
794 | ||
f517f1f2 | 795 | test_expect_success 'allow deleting a ref using --delete' ' |
2e433b78 | 796 | mk_test testrepo heads/master && |
f517f1f2 JK |
797 | (cd testrepo && git config receive.denyDeleteCurrent warn) && |
798 | git push testrepo --delete master && | |
799 | (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master) | |
800 | ' | |
801 | ||
802 | test_expect_success 'allow deleting a tag using --delete' ' | |
2e433b78 | 803 | mk_test testrepo heads/master && |
f517f1f2 JK |
804 | git tag -a -m dummy_message deltag heads/master && |
805 | git push testrepo --tags && | |
806 | (cd testrepo && git rev-parse --verify -q refs/tags/deltag) && | |
807 | git push testrepo --delete tag deltag && | |
808 | (cd testrepo && test_must_fail git rev-parse --verify refs/tags/deltag) | |
809 | ' | |
810 | ||
811 | test_expect_success 'push --delete without args aborts' ' | |
2e433b78 | 812 | mk_test testrepo heads/master && |
f517f1f2 JK |
813 | test_must_fail git push testrepo --delete |
814 | ' | |
815 | ||
816 | test_expect_success 'push --delete refuses src:dest refspecs' ' | |
2e433b78 | 817 | mk_test testrepo heads/master && |
f517f1f2 JK |
818 | test_must_fail git push testrepo --delete master:foo |
819 | ' | |
820 | ||
986e8239 | 821 | test_expect_success 'warn on push to HEAD of non-bare repository' ' |
2e433b78 | 822 | mk_test testrepo heads/master && |
d4785cd1 JS |
823 | ( |
824 | cd testrepo && | |
986e8239 | 825 | git checkout master && |
d4785cd1 JS |
826 | git config receive.denyCurrentBranch warn |
827 | ) && | |
986e8239 | 828 | git push testrepo master 2>stderr && |
3d95d92b | 829 | grep "warning: updating the current branch" stderr |
986e8239 JK |
830 | ' |
831 | ||
832 | test_expect_success 'deny push to HEAD of non-bare repository' ' | |
2e433b78 | 833 | mk_test testrepo heads/master && |
d4785cd1 JS |
834 | ( |
835 | cd testrepo && | |
986e8239 | 836 | git checkout master && |
d4785cd1 JS |
837 | git config receive.denyCurrentBranch true |
838 | ) && | |
986e8239 JK |
839 | test_must_fail git push testrepo master |
840 | ' | |
841 | ||
842 | test_expect_success 'allow push to HEAD of bare repository (bare)' ' | |
2e433b78 | 843 | mk_test testrepo heads/master && |
d4785cd1 JS |
844 | ( |
845 | cd testrepo && | |
986e8239 JK |
846 | git checkout master && |
847 | git config receive.denyCurrentBranch true && | |
d4785cd1 JS |
848 | git config core.bare true |
849 | ) && | |
986e8239 | 850 | git push testrepo master 2>stderr && |
3d95d92b | 851 | ! grep "warning: updating the current branch" stderr |
986e8239 JK |
852 | ' |
853 | ||
854 | test_expect_success 'allow push to HEAD of non-bare repository (config)' ' | |
2e433b78 | 855 | mk_test testrepo heads/master && |
d4785cd1 JS |
856 | ( |
857 | cd testrepo && | |
986e8239 JK |
858 | git checkout master && |
859 | git config receive.denyCurrentBranch false | |
860 | ) && | |
861 | git push testrepo master 2>stderr && | |
3d95d92b | 862 | ! grep "warning: updating the current branch" stderr |
986e8239 JK |
863 | ' |
864 | ||
18afe101 | 865 | test_expect_success 'fetch with branches' ' |
2e433b78 | 866 | mk_empty testrepo && |
18afe101 MK |
867 | git branch second $the_first_commit && |
868 | git checkout second && | |
869 | echo ".." > testrepo/.git/branches/branch1 && | |
d4785cd1 JS |
870 | ( |
871 | cd testrepo && | |
18afe101 | 872 | git fetch branch1 && |
848575d8 JN |
873 | echo "$the_commit commit refs/heads/branch1" >expect && |
874 | git for-each-ref refs/heads >actual && | |
875 | test_cmp expect actual | |
18afe101 MK |
876 | ) && |
877 | git checkout master | |
878 | ' | |
879 | ||
880 | test_expect_success 'fetch with branches containing #' ' | |
2e433b78 | 881 | mk_empty testrepo && |
18afe101 | 882 | echo "..#second" > testrepo/.git/branches/branch2 && |
d4785cd1 JS |
883 | ( |
884 | cd testrepo && | |
18afe101 | 885 | git fetch branch2 && |
848575d8 JN |
886 | echo "$the_first_commit commit refs/heads/branch2" >expect && |
887 | git for-each-ref refs/heads >actual && | |
888 | test_cmp expect actual | |
18afe101 MK |
889 | ) && |
890 | git checkout master | |
891 | ' | |
892 | ||
893 | test_expect_success 'push with branches' ' | |
2e433b78 | 894 | mk_empty testrepo && |
18afe101 MK |
895 | git checkout second && |
896 | echo "testrepo" > .git/branches/branch1 && | |
897 | git push branch1 && | |
d4785cd1 JS |
898 | ( |
899 | cd testrepo && | |
848575d8 JN |
900 | echo "$the_first_commit commit refs/heads/master" >expect && |
901 | git for-each-ref refs/heads >actual && | |
902 | test_cmp expect actual | |
18afe101 MK |
903 | ) |
904 | ' | |
905 | ||
906 | test_expect_success 'push with branches containing #' ' | |
2e433b78 | 907 | mk_empty testrepo && |
18afe101 MK |
908 | echo "testrepo#branch3" > .git/branches/branch2 && |
909 | git push branch2 && | |
d4785cd1 JS |
910 | ( |
911 | cd testrepo && | |
848575d8 JN |
912 | echo "$the_first_commit commit refs/heads/branch3" >expect && |
913 | git for-each-ref refs/heads >actual && | |
914 | test_cmp expect actual | |
18afe101 MK |
915 | ) && |
916 | git checkout master | |
917 | ' | |
918 | ||
da3efdb1 | 919 | test_expect_success 'push into aliased refs (consistent)' ' |
2e433b78 JK |
920 | mk_test testrepo heads/master && |
921 | mk_child testrepo child1 && | |
922 | mk_child testrepo child2 && | |
da3efdb1 JS |
923 | ( |
924 | cd child1 && | |
925 | git branch foo && | |
926 | git symbolic-ref refs/heads/bar refs/heads/foo | |
927 | git config receive.denyCurrentBranch false | |
928 | ) && | |
929 | ( | |
930 | cd child2 && | |
931 | >path2 && | |
932 | git add path2 && | |
933 | test_tick && | |
934 | git commit -a -m child2 && | |
935 | git branch foo && | |
936 | git branch bar && | |
937 | git push ../child1 foo bar | |
938 | ) | |
939 | ' | |
940 | ||
941 | test_expect_success 'push into aliased refs (inconsistent)' ' | |
2e433b78 JK |
942 | mk_test testrepo heads/master && |
943 | mk_child testrepo child1 && | |
944 | mk_child testrepo child2 && | |
da3efdb1 JS |
945 | ( |
946 | cd child1 && | |
947 | git branch foo && | |
948 | git symbolic-ref refs/heads/bar refs/heads/foo | |
949 | git config receive.denyCurrentBranch false | |
950 | ) && | |
951 | ( | |
952 | cd child2 && | |
953 | >path2 && | |
954 | git add path2 && | |
955 | test_tick && | |
956 | git commit -a -m child2 && | |
957 | git branch foo && | |
958 | >path3 && | |
959 | git add path3 && | |
960 | test_tick && | |
961 | git commit -a -m child2 && | |
962 | git branch bar && | |
963 | test_must_fail git push ../child1 foo bar 2>stderr && | |
964 | grep "refusing inconsistent update" stderr | |
965 | ) | |
966 | ' | |
967 | ||
dbfeddb1 | 968 | test_expect_success 'push requires --force to update lightweight tag' ' |
2e433b78 JK |
969 | mk_test testrepo heads/master && |
970 | mk_child testrepo child1 && | |
971 | mk_child testrepo child2 && | |
dbfeddb1 CR |
972 | ( |
973 | cd child1 && | |
974 | git tag Tag && | |
975 | git push ../child2 Tag && | |
976 | git push ../child2 Tag && | |
977 | >file1 && | |
978 | git add file1 && | |
979 | git commit -m "file1" && | |
980 | git tag -f Tag && | |
981 | test_must_fail git push ../child2 Tag && | |
982 | git push --force ../child2 Tag && | |
983 | git tag -f Tag && | |
984 | test_must_fail git push ../child2 Tag HEAD~ && | |
985 | git push --force ../child2 Tag | |
986 | ) | |
987 | ' | |
988 | ||
fbe4f447 | 989 | test_expect_success 'push --porcelain' ' |
2e433b78 | 990 | mk_empty testrepo && |
fbe4f447 LA |
991 | echo >.git/foo "To testrepo" && |
992 | echo >>.git/foo "* refs/heads/master:refs/remotes/origin/master [new branch]" && | |
993 | echo >>.git/foo "Done" && | |
994 | git push >.git/bar --porcelain testrepo refs/heads/master:refs/remotes/origin/master && | |
995 | ( | |
996 | cd testrepo && | |
848575d8 JN |
997 | echo "$the_commit commit refs/remotes/origin/master" >expect && |
998 | git for-each-ref refs/remotes/origin >actual && | |
999 | test_cmp expect actual | |
fbe4f447 | 1000 | ) && |
c296134d | 1001 | test_cmp .git/foo .git/bar |
fbe4f447 LA |
1002 | ' |
1003 | ||
1004 | test_expect_success 'push --porcelain bad url' ' | |
2e433b78 | 1005 | mk_empty testrepo && |
fbe4f447 | 1006 | test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master && |
c7cf9566 | 1007 | ! grep -q Done .git/bar |
fbe4f447 LA |
1008 | ' |
1009 | ||
1010 | test_expect_success 'push --porcelain rejected' ' | |
2e433b78 | 1011 | mk_empty testrepo && |
fbe4f447 LA |
1012 | git push testrepo refs/heads/master:refs/remotes/origin/master && |
1013 | (cd testrepo && | |
1014 | git reset --hard origin/master^ | |
1015 | git config receive.denyCurrentBranch true) && | |
1016 | ||
1017 | echo >.git/foo "To testrepo" && | |
1018 | echo >>.git/foo "! refs/heads/master:refs/heads/master [remote rejected] (branch is currently checked out)" && | |
1019 | ||
1020 | test_must_fail git push >.git/bar --porcelain testrepo refs/heads/master:refs/heads/master && | |
c296134d | 1021 | test_cmp .git/foo .git/bar |
fbe4f447 LA |
1022 | ' |
1023 | ||
1024 | test_expect_success 'push --porcelain --dry-run rejected' ' | |
2e433b78 | 1025 | mk_empty testrepo && |
fbe4f447 LA |
1026 | git push testrepo refs/heads/master:refs/remotes/origin/master && |
1027 | (cd testrepo && | |
1028 | git reset --hard origin/master | |
1029 | git config receive.denyCurrentBranch true) && | |
1030 | ||
1031 | echo >.git/foo "To testrepo" && | |
1032 | echo >>.git/foo "! refs/heads/master^:refs/heads/master [rejected] (non-fast-forward)" && | |
1033 | echo >>.git/foo "Done" && | |
1034 | ||
1035 | test_must_fail git push >.git/bar --porcelain --dry-run testrepo refs/heads/master^:refs/heads/master && | |
c296134d | 1036 | test_cmp .git/foo .git/bar |
fbe4f447 LA |
1037 | ' |
1038 | ||
6ddba5e2 | 1039 | test_expect_success 'push --prune' ' |
2e433b78 | 1040 | mk_test testrepo heads/master heads/second heads/foo heads/bar && |
0a42ac03 | 1041 | git push --prune testrepo : && |
2e433b78 JK |
1042 | check_push_result testrepo $the_commit heads/master && |
1043 | check_push_result testrepo $the_first_commit heads/second && | |
1044 | ! check_push_result testrepo $the_first_commit heads/foo heads/bar | |
6ddba5e2 FC |
1045 | ' |
1046 | ||
1047 | test_expect_success 'push --prune refspec' ' | |
2e433b78 | 1048 | mk_test testrepo tmp/master tmp/second tmp/foo tmp/bar && |
6ddba5e2 | 1049 | git push --prune testrepo "refs/heads/*:refs/tmp/*" && |
2e433b78 JK |
1050 | check_push_result testrepo $the_commit tmp/master && |
1051 | check_push_result testrepo $the_first_commit tmp/second && | |
1052 | ! check_push_result testrepo $the_first_commit tmp/foo tmp/bar | |
6ddba5e2 FC |
1053 | ' |
1054 | ||
daebaa78 JH |
1055 | for configsection in transfer receive |
1056 | do | |
1057 | test_expect_success "push to update a ref hidden by $configsection.hiderefs" ' | |
2e433b78 | 1058 | mk_test testrepo heads/master hidden/one hidden/two hidden/three && |
daebaa78 JH |
1059 | ( |
1060 | cd testrepo && | |
1061 | git config $configsection.hiderefs refs/hidden | |
1062 | ) && | |
1063 | ||
1064 | # push to unhidden ref succeeds normally | |
1065 | git push testrepo master:refs/heads/master && | |
2e433b78 | 1066 | check_push_result testrepo $the_commit heads/master && |
daebaa78 JH |
1067 | |
1068 | # push to update a hidden ref should fail | |
1069 | test_must_fail git push testrepo master:refs/hidden/one && | |
2e433b78 | 1070 | check_push_result testrepo $the_first_commit hidden/one && |
daebaa78 JH |
1071 | |
1072 | # push to delete a hidden ref should fail | |
1073 | test_must_fail git push testrepo :refs/hidden/two && | |
2e433b78 | 1074 | check_push_result testrepo $the_first_commit hidden/two && |
daebaa78 JH |
1075 | |
1076 | # idempotent push to update a hidden ref should fail | |
1077 | test_must_fail git push testrepo $the_first_commit:refs/hidden/three && | |
2e433b78 | 1078 | check_push_result testrepo $the_first_commit hidden/three |
daebaa78 JH |
1079 | ' |
1080 | done | |
1081 | ||
6e7b66ee | 1082 | test_expect_success 'fetch exact SHA1' ' |
2e433b78 | 1083 | mk_test testrepo heads/master hidden/one && |
6e7b66ee JH |
1084 | git push testrepo master:refs/hidden/one && |
1085 | ( | |
1086 | cd testrepo && | |
1087 | git config transfer.hiderefs refs/hidden | |
1088 | ) && | |
2e433b78 | 1089 | check_push_result testrepo $the_commit hidden/one && |
6e7b66ee | 1090 | |
2e433b78 | 1091 | mk_child testrepo child && |
6e7b66ee JH |
1092 | ( |
1093 | cd child && | |
1094 | ||
1095 | # make sure $the_commit does not exist here | |
1096 | git repack -a -d && | |
1097 | git prune && | |
1098 | test_must_fail git cat-file -t $the_commit && | |
1099 | ||
1100 | # fetching the hidden object should fail by default | |
e70a65c5 | 1101 | test_must_fail git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err && |
d56583de | 1102 | test_i18ngrep "Server does not allow request for unadvertised object" err && |
6e7b66ee JH |
1103 | test_must_fail git rev-parse --verify refs/heads/copy && |
1104 | ||
1105 | # the server side can allow it to succeed | |
1106 | ( | |
1107 | cd ../testrepo && | |
1108 | git config uploadpack.allowtipsha1inwant true | |
1109 | ) && | |
1110 | ||
c3c17bf1 JK |
1111 | git fetch -v ../testrepo $the_commit:refs/heads/copy master:refs/heads/extra && |
1112 | cat >expect <<-EOF && | |
1113 | $the_commit | |
1114 | $the_first_commit | |
1115 | EOF | |
1116 | { | |
1117 | git rev-parse --verify refs/heads/copy && | |
1118 | git rev-parse --verify refs/heads/extra | |
1119 | } >actual && | |
1120 | test_cmp expect actual | |
6e7b66ee JH |
1121 | ) |
1122 | ' | |
1123 | ||
68ee6289 FM |
1124 | for configallowtipsha1inwant in true false |
1125 | do | |
1126 | test_expect_success "shallow fetch reachable SHA1 (but not a ref), allowtipsha1inwant=$configallowtipsha1inwant" ' | |
1127 | mk_empty testrepo && | |
1128 | ( | |
1129 | cd testrepo && | |
1130 | git config uploadpack.allowtipsha1inwant $configallowtipsha1inwant && | |
1131 | git commit --allow-empty -m foo && | |
1132 | git commit --allow-empty -m bar | |
1133 | ) && | |
1134 | SHA1=$(git --git-dir=testrepo/.git rev-parse HEAD^) && | |
1135 | mk_empty shallow && | |
1136 | ( | |
1137 | cd shallow && | |
1138 | test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 && | |
1139 | git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && | |
1140 | git fetch --depth=1 ../testrepo/.git $SHA1 && | |
1141 | git cat-file commit $SHA1 | |
1142 | ) | |
1143 | ' | |
1144 | ||
1145 | test_expect_success "deny fetch unreachable SHA1, allowtipsha1inwant=$configallowtipsha1inwant" ' | |
1146 | mk_empty testrepo && | |
1147 | ( | |
1148 | cd testrepo && | |
1149 | git config uploadpack.allowtipsha1inwant $configallowtipsha1inwant && | |
1150 | git commit --allow-empty -m foo && | |
1151 | git commit --allow-empty -m bar && | |
1152 | git commit --allow-empty -m xyz | |
1153 | ) && | |
1154 | SHA1_1=$(git --git-dir=testrepo/.git rev-parse HEAD^^) && | |
1155 | SHA1_2=$(git --git-dir=testrepo/.git rev-parse HEAD^) && | |
1156 | SHA1_3=$(git --git-dir=testrepo/.git rev-parse HEAD) && | |
1157 | ( | |
1158 | cd testrepo && | |
1159 | git reset --hard $SHA1_2 && | |
1160 | git cat-file commit $SHA1_1 && | |
1161 | git cat-file commit $SHA1_3 | |
1162 | ) && | |
1163 | mk_empty shallow && | |
1164 | ( | |
1165 | cd shallow && | |
8bf4becf LS |
1166 | test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 && |
1167 | test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_1 && | |
68ee6289 FM |
1168 | git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && |
1169 | git fetch ../testrepo/.git $SHA1_1 && | |
1170 | git cat-file commit $SHA1_1 && | |
1171 | test_must_fail git cat-file commit $SHA1_2 && | |
1172 | git fetch ../testrepo/.git $SHA1_2 && | |
1173 | git cat-file commit $SHA1_2 && | |
8bf4becf | 1174 | test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 |
68ee6289 FM |
1175 | ) |
1176 | ' | |
1177 | done | |
1178 | ||
c2aba155 | 1179 | test_expect_success 'fetch follows tags by default' ' |
2e433b78 | 1180 | mk_test testrepo heads/master && |
c2aba155 JH |
1181 | rm -fr src dst && |
1182 | git init src && | |
1183 | ( | |
1184 | cd src && | |
1185 | git pull ../testrepo master && | |
1186 | git tag -m "annotated" tag && | |
1187 | git for-each-ref >tmp1 && | |
1188 | ( | |
1189 | cat tmp1 | |
1190 | sed -n "s|refs/heads/master$|refs/remotes/origin/master|p" tmp1 | |
1191 | ) | | |
1192 | sort -k 3 >../expect | |
1193 | ) && | |
1194 | git init dst && | |
1195 | ( | |
1196 | cd dst && | |
1197 | git remote add origin ../src && | |
1198 | git config branch.master.remote origin && | |
1199 | git config branch.master.merge refs/heads/master && | |
1200 | git pull && | |
1201 | git for-each-ref >../actual | |
1202 | ) && | |
1203 | test_cmp expect actual | |
1204 | ' | |
1205 | ||
ca02465b JH |
1206 | test_expect_success 'pushing a specific ref applies remote.$name.push as refmap' ' |
1207 | mk_test testrepo heads/master && | |
1208 | rm -fr src dst && | |
1209 | git init src && | |
1210 | git init --bare dst && | |
1211 | ( | |
1212 | cd src && | |
1213 | git pull ../testrepo master && | |
1214 | git branch next && | |
1215 | git config remote.dst.url ../dst && | |
1216 | git config remote.dst.push "+refs/heads/*:refs/remotes/src/*" && | |
1217 | git push dst master && | |
1218 | git show-ref refs/heads/master | | |
1219 | sed -e "s|refs/heads/|refs/remotes/src/|" >../dst/expect | |
1220 | ) && | |
1221 | ( | |
1222 | cd dst && | |
1223 | test_must_fail git show-ref refs/heads/next && | |
1224 | test_must_fail git show-ref refs/heads/master && | |
1225 | git show-ref refs/remotes/src/master >actual | |
1226 | ) && | |
1227 | test_cmp dst/expect dst/actual | |
1228 | ' | |
1229 | ||
1230 | test_expect_success 'with no remote.$name.push, it is not used as refmap' ' | |
1231 | mk_test testrepo heads/master && | |
1232 | rm -fr src dst && | |
1233 | git init src && | |
1234 | git init --bare dst && | |
1235 | ( | |
1236 | cd src && | |
1237 | git pull ../testrepo master && | |
1238 | git branch next && | |
1239 | git config remote.dst.url ../dst && | |
fc9261ca | 1240 | git config push.default matching && |
ca02465b JH |
1241 | git push dst master && |
1242 | git show-ref refs/heads/master >../dst/expect | |
1243 | ) && | |
1244 | ( | |
1245 | cd dst && | |
1246 | test_must_fail git show-ref refs/heads/next && | |
1247 | git show-ref refs/heads/master >actual | |
1248 | ) && | |
1249 | test_cmp dst/expect dst/actual | |
1250 | ' | |
1251 | ||
fc9261ca JH |
1252 | test_expect_success 'with no remote.$name.push, upstream mapping is used' ' |
1253 | mk_test testrepo heads/master && | |
1254 | rm -fr src dst && | |
1255 | git init src && | |
1256 | git init --bare dst && | |
1257 | ( | |
1258 | cd src && | |
1259 | git pull ../testrepo master && | |
1260 | git branch next && | |
1261 | git config remote.dst.url ../dst && | |
1262 | git config remote.dst.fetch "+refs/heads/*:refs/remotes/dst/*" && | |
1263 | git config push.default upstream && | |
1264 | ||
1265 | git config branch.master.merge refs/heads/trunk && | |
1266 | git config branch.master.remote dst && | |
1267 | ||
1268 | git push dst master && | |
1269 | git show-ref refs/heads/master | | |
1270 | sed -e "s|refs/heads/master|refs/heads/trunk|" >../dst/expect | |
1271 | ) && | |
1272 | ( | |
1273 | cd dst && | |
1274 | test_must_fail git show-ref refs/heads/master && | |
1275 | test_must_fail git show-ref refs/heads/next && | |
1276 | git show-ref refs/heads/trunk >actual | |
1277 | ) && | |
1278 | test_cmp dst/expect dst/actual | |
1279 | ' | |
1280 | ||
c2aba155 | 1281 | test_expect_success 'push does not follow tags by default' ' |
2e433b78 | 1282 | mk_test testrepo heads/master && |
c2aba155 JH |
1283 | rm -fr src dst && |
1284 | git init src && | |
1285 | git init --bare dst && | |
1286 | ( | |
1287 | cd src && | |
1288 | git pull ../testrepo master && | |
1289 | git tag -m "annotated" tag && | |
1290 | git checkout -b another && | |
1291 | git commit --allow-empty -m "future commit" && | |
1292 | git tag -m "future" future && | |
1293 | git checkout master && | |
1294 | git for-each-ref refs/heads/master >../expect && | |
1295 | git push ../dst master | |
1296 | ) && | |
1297 | ( | |
1298 | cd dst && | |
1299 | git for-each-ref >../actual | |
1300 | ) && | |
1301 | test_cmp expect actual | |
1302 | ' | |
1303 | ||
1304 | test_expect_success 'push --follow-tag only pushes relevant tags' ' | |
2e433b78 | 1305 | mk_test testrepo heads/master && |
c2aba155 JH |
1306 | rm -fr src dst && |
1307 | git init src && | |
1308 | git init --bare dst && | |
1309 | ( | |
1310 | cd src && | |
1311 | git pull ../testrepo master && | |
1312 | git tag -m "annotated" tag && | |
1313 | git checkout -b another && | |
1314 | git commit --allow-empty -m "future commit" && | |
1315 | git tag -m "future" future && | |
1316 | git checkout master && | |
1317 | git for-each-ref refs/heads/master refs/tags/tag >../expect | |
1318 | git push --follow-tag ../dst master | |
1319 | ) && | |
1320 | ( | |
1321 | cd dst && | |
1322 | git for-each-ref >../actual | |
1323 | ) && | |
1324 | test_cmp expect actual | |
1325 | ' | |
1326 | ||
f7c815c3 NTND |
1327 | test_expect_success 'push --no-thin must produce non-thin pack' ' |
1328 | cat >>path1 <<\EOF && | |
1329 | keep base version of path1 big enough, compared to the new changes | |
1330 | later, in order to pass size heuristics in | |
1331 | builtin/pack-objects.c:try_delta() | |
1332 | EOF | |
1333 | git commit -am initial && | |
1334 | git init no-thin && | |
1335 | git --git-dir=no-thin/.git config receive.unpacklimit 0 && | |
1336 | git push no-thin/.git refs/heads/master:refs/heads/foo && | |
1337 | echo modified >> path1 && | |
1338 | git commit -am modified && | |
1339 | git repack -adf && | |
1340 | rcvpck="git receive-pack --reject-thin-pack-for-testing" && | |
1341 | git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo | |
1342 | ' | |
1343 | ||
458a7e50 JK |
1344 | test_expect_success 'pushing a tag pushes the tagged object' ' |
1345 | rm -rf dst.git && | |
1346 | blob=$(echo unreferenced | git hash-object -w --stdin) && | |
1347 | git tag -m foo tag-of-blob $blob && | |
1348 | git init --bare dst.git && | |
1349 | git push dst.git tag-of-blob && | |
1350 | # the receiving index-pack should have noticed | |
1351 | # any problems, but we double check | |
1352 | echo unreferenced >expect && | |
1353 | git --git-dir=dst.git cat-file blob tag-of-blob >actual && | |
1354 | test_cmp expect actual | |
1355 | ' | |
1356 | ||
72549dfd JK |
1357 | test_expect_success 'push into bare respects core.logallrefupdates' ' |
1358 | rm -rf dst.git && | |
1359 | git init --bare dst.git && | |
1360 | git -C dst.git config core.logallrefupdates true && | |
1361 | ||
1362 | # double push to test both with and without | |
1363 | # the actual pack transfer | |
1364 | git push dst.git master:one && | |
1365 | echo "one@{0} push" >expect && | |
1366 | git -C dst.git log -g --format="%gd %gs" one >actual && | |
1367 | test_cmp expect actual && | |
1368 | ||
1369 | git push dst.git master:two && | |
1370 | echo "two@{0} push" >expect && | |
1371 | git -C dst.git log -g --format="%gd %gs" two >actual && | |
1372 | test_cmp expect actual | |
1373 | ' | |
1374 | ||
1375 | test_expect_success 'fetch into bare respects core.logallrefupdates' ' | |
1376 | rm -rf dst.git && | |
1377 | git init --bare dst.git && | |
1378 | ( | |
1379 | cd dst.git && | |
1380 | git config core.logallrefupdates true && | |
1381 | ||
1382 | # as above, we double-fetch to test both | |
1383 | # with and without pack transfer | |
1384 | git fetch .. master:one && | |
1385 | echo "one@{0} fetch .. master:one: storing head" >expect && | |
1386 | git log -g --format="%gd %gs" one >actual && | |
1387 | test_cmp expect actual && | |
1388 | ||
1389 | git fetch .. master:two && | |
1390 | echo "two@{0} fetch .. master:two: storing head" >expect && | |
1391 | git log -g --format="%gd %gs" two >actual && | |
1392 | test_cmp expect actual | |
1393 | ) | |
1394 | ' | |
1395 | ||
1404bcbb JS |
1396 | test_expect_success 'receive.denyCurrentBranch = updateInstead' ' |
1397 | git push testrepo master && | |
4d7a5cea JH |
1398 | ( |
1399 | cd testrepo && | |
1404bcbb JS |
1400 | git reset --hard && |
1401 | git config receive.denyCurrentBranch updateInstead | |
1402 | ) && | |
1403 | test_commit third path2 && | |
4d7a5cea JH |
1404 | |
1405 | # Try pushing into a repository with pristine working tree | |
1404bcbb | 1406 | git push testrepo master && |
4d7a5cea JH |
1407 | ( |
1408 | cd testrepo && | |
1409 | git update-index -q --refresh && | |
1410 | git diff-files --quiet -- && | |
1411 | git diff-index --quiet --cached HEAD -- && | |
1412 | test third = "$(cat path2)" && | |
1413 | test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD) | |
1414 | ) && | |
1415 | ||
1416 | # Try pushing into a repository with working tree needing a refresh | |
1417 | ( | |
1418 | cd testrepo && | |
1419 | git reset --hard HEAD^ && | |
1420 | test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) && | |
1421 | test-chmtime +100 path1 | |
1422 | ) && | |
1423 | git push testrepo master && | |
1424 | ( | |
1425 | cd testrepo && | |
1404bcbb JS |
1426 | git update-index -q --refresh && |
1427 | git diff-files --quiet -- && | |
1428 | git diff-index --quiet --cached HEAD -- && | |
4d7a5cea JH |
1429 | test_cmp ../path1 path1 && |
1430 | test third = "$(cat path2)" && | |
1431 | test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD) | |
1404bcbb | 1432 | ) && |
4d7a5cea JH |
1433 | |
1434 | # Update what is to be pushed | |
1404bcbb | 1435 | test_commit fourth path2 && |
4d7a5cea JH |
1436 | |
1437 | # Try pushing into a repository with a dirty working tree | |
1438 | # (1) the working tree updated | |
1439 | ( | |
1440 | cd testrepo && | |
1441 | echo changed >path1 | |
1442 | ) && | |
1404bcbb | 1443 | test_must_fail git push testrepo master && |
4d7a5cea JH |
1444 | ( |
1445 | cd testrepo && | |
1446 | test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) && | |
1447 | git diff --quiet --cached && | |
1448 | test changed = "$(cat path1)" | |
1449 | ) && | |
1450 | ||
1451 | # (2) the index updated | |
1452 | ( | |
1453 | cd testrepo && | |
1454 | echo changed >path1 && | |
1455 | git add path1 | |
1456 | ) && | |
1457 | test_must_fail git push testrepo master && | |
1458 | ( | |
1459 | cd testrepo && | |
1460 | test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) && | |
1461 | git diff --quiet && | |
1462 | test changed = "$(cat path1)" | |
1463 | ) && | |
1464 | ||
1465 | # Introduce a new file in the update | |
1466 | test_commit fifth path3 && | |
1467 | ||
1468 | # (3) the working tree has an untracked file that would interfere | |
1469 | ( | |
1470 | cd testrepo && | |
1471 | git reset --hard && | |
1472 | echo changed >path3 | |
1473 | ) && | |
1474 | test_must_fail git push testrepo master && | |
1475 | ( | |
1476 | cd testrepo && | |
1477 | test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) && | |
1478 | git diff --quiet && | |
1479 | git diff --quiet --cached && | |
1480 | test changed = "$(cat path3)" | |
1481 | ) && | |
1482 | ||
1483 | # (4) the target changes to what gets pushed but it still is a change | |
1484 | ( | |
1485 | cd testrepo && | |
1486 | git reset --hard && | |
1487 | echo fifth >path3 && | |
1488 | git add path3 | |
1489 | ) && | |
1490 | test_must_fail git push testrepo master && | |
1491 | ( | |
1492 | cd testrepo && | |
1493 | test $(git -C .. rev-parse HEAD^^) = $(git rev-parse HEAD) && | |
1404bcbb | 1494 | git diff --quiet && |
4d7a5cea | 1495 | test fifth = "$(cat path3)" |
1a51b524 | 1496 | ) && |
4d7a5cea | 1497 | |
1a51b524 JH |
1498 | # (5) push into void |
1499 | rm -fr void && | |
1500 | git init void && | |
1501 | ( | |
1502 | cd void && | |
1503 | git config receive.denyCurrentBranch updateInstead | |
1504 | ) && | |
1505 | git push void master && | |
1506 | ( | |
1507 | cd void && | |
1508 | test $(git -C .. rev-parse master) = $(git rev-parse HEAD) && | |
1509 | git diff --quiet && | |
1510 | git diff --cached --quiet | |
1511 | ) | |
1404bcbb JS |
1512 | ' |
1513 | ||
08553319 JH |
1514 | test_expect_success 'updateInstead with push-to-checkout hook' ' |
1515 | rm -fr testrepo && | |
1516 | git init testrepo && | |
1517 | ( | |
1518 | cd testrepo && | |
1519 | git pull .. master && | |
1520 | git reset --hard HEAD^^ && | |
1521 | git tag initial && | |
1522 | git config receive.denyCurrentBranch updateInstead && | |
1523 | write_script .git/hooks/push-to-checkout <<-\EOF | |
1524 | echo >&2 updating from $(git rev-parse HEAD) | |
1525 | echo >&2 updating to "$1" | |
1526 | ||
1527 | git update-index -q --refresh && | |
1528 | git read-tree -u -m HEAD "$1" || { | |
1529 | status=$? | |
1530 | echo >&2 read-tree failed | |
1531 | exit $status | |
1532 | } | |
1533 | EOF | |
1534 | ) && | |
1535 | ||
1536 | # Try pushing into a pristine | |
1537 | git push testrepo master && | |
1538 | ( | |
1539 | cd testrepo && | |
1540 | git diff --quiet && | |
1541 | git diff HEAD --quiet && | |
1542 | test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD) | |
1543 | ) && | |
1544 | ||
1545 | # Try pushing into a repository with conflicting change | |
1546 | ( | |
1547 | cd testrepo && | |
1548 | git reset --hard initial && | |
1549 | echo conflicting >path2 | |
1550 | ) && | |
1551 | test_must_fail git push testrepo master && | |
1552 | ( | |
1553 | cd testrepo && | |
1554 | test $(git rev-parse initial) = $(git rev-parse HEAD) && | |
1555 | test conflicting = "$(cat path2)" && | |
1556 | git diff-index --quiet --cached HEAD | |
1557 | ) && | |
1558 | ||
1559 | # Try pushing into a repository with unrelated change | |
1560 | ( | |
1561 | cd testrepo && | |
1562 | git reset --hard initial && | |
1563 | echo unrelated >path1 && | |
1564 | echo irrelevant >path5 && | |
1565 | git add path5 | |
1566 | ) && | |
1567 | git push testrepo master && | |
1568 | ( | |
1569 | cd testrepo && | |
1570 | test "$(cat path1)" = unrelated && | |
1571 | test "$(cat path5)" = irrelevant && | |
1572 | test "$(git diff --name-only --cached HEAD)" = path5 && | |
1573 | test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD) | |
1a51b524 JH |
1574 | ) && |
1575 | ||
1576 | # push into void | |
1577 | rm -fr void && | |
1578 | git init void && | |
1579 | ( | |
1580 | cd void && | |
1581 | git config receive.denyCurrentBranch updateInstead && | |
1582 | write_script .git/hooks/push-to-checkout <<-\EOF | |
1583 | if git rev-parse --quiet --verify HEAD | |
1584 | then | |
1585 | has_head=yes | |
1586 | echo >&2 updating from $(git rev-parse HEAD) | |
1587 | else | |
1588 | has_head=no | |
1589 | echo >&2 pushing into void | |
1590 | fi | |
1591 | echo >&2 updating to "$1" | |
1592 | ||
1593 | git update-index -q --refresh && | |
1594 | case "$has_head" in | |
1595 | yes) | |
1596 | git read-tree -u -m HEAD "$1" ;; | |
1597 | no) | |
1598 | git read-tree -u -m "$1" ;; | |
1599 | esac || { | |
1600 | status=$? | |
1601 | echo >&2 read-tree failed | |
1602 | exit $status | |
1603 | } | |
1604 | EOF | |
1605 | ) && | |
1606 | ||
1607 | git push void master && | |
1608 | ( | |
1609 | cd void && | |
1610 | git diff --quiet && | |
1611 | git diff --cached --quiet && | |
1612 | test $(git -C .. rev-parse HEAD) = $(git rev-parse HEAD) | |
08553319 JH |
1613 | ) |
1614 | ' | |
1615 | ||
bcdb34f7 | 1616 | test_done |