1 # Refs of upstream : main(A)
2 # Refs of workbench: main(A) tags/v123
3 # git push : next(A) refs/for/main/topic(A)
4 test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/porcelain)" '
5 test_must_fail git -C workbench push --porcelain origin \
7 HEAD:refs/for/main/topic \
9 make_user_friendly_and_stable_output <out >actual &&
11 remote: # pre-receive hook
12 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
13 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
14 remote: error: cannot find hook "proc-receive"
15 remote: # post-receive hook
16 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 To <URL/of/upstream.git>
18 * HEAD:refs/heads/next [new branch]
19 ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
22 test_cmp expect actual &&
23 git -C "$upstream" show-ref >out &&
24 make_user_friendly_and_stable_output <out >actual &&
26 <COMMIT-A> refs/heads/main
27 <COMMIT-A> refs/heads/next
29 test_cmp expect actual
32 # Refs of upstream : main(A) next(A)
33 # Refs of workbench: main(A) tags/v123
34 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
35 git -C "$upstream" update-ref -d refs/heads/next
38 # Refs of upstream : main(A)
39 # Refs of workbench: main(A) tags/v123
40 # git push --atomic: (B) next(A) refs/for/main/topic(A)
41 test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL/porcelain)" '
42 test_must_fail git -C workbench push --porcelain --atomic origin \
45 HEAD:refs/for/main/topic >out 2>&1 &&
46 make_user_friendly_and_stable_output <out >actual &&
48 remote: # pre-receive hook
49 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
51 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
52 remote: error: cannot find hook "proc-receive"
53 To <URL/of/upstream.git>
54 ! <COMMIT-B>:refs/heads/main [remote rejected] (fail to run proc-receive hook)
55 ! HEAD:refs/heads/next [remote rejected] (fail to run proc-receive hook)
56 ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
59 test_cmp expect actual &&
60 git -C "$upstream" show-ref >out &&
61 make_user_friendly_and_stable_output <out >actual &&
63 <COMMIT-A> refs/heads/main
65 test_cmp expect actual