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)" '
5 test_must_fail git -C workbench push 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 * [new branch] HEAD -> next
19 ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
21 test_cmp expect actual &&
22 git -C "$upstream" show-ref >out &&
23 make_user_friendly_and_stable_output <out >actual &&
25 <COMMIT-A> refs/heads/main
26 <COMMIT-A> refs/heads/next
28 test_cmp expect actual
31 # Refs of upstream : main(A) next(A)
32 # Refs of workbench: main(A) tags/v123
33 test_expect_success "cleanup ($PROTOCOL)" '
34 git -C "$upstream" update-ref -d refs/heads/next
37 # Refs of upstream : main(A)
38 # Refs of workbench: main(A) tags/v123
39 # git push --atomic: (B) next(A) refs/for/main/topic(A)
40 test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL)" '
41 test_must_fail git -C workbench push --atomic origin \
44 HEAD:refs/for/main/topic >out 2>&1 &&
45 make_user_friendly_and_stable_output <out >actual &&
47 remote: # pre-receive hook
48 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
49 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
51 remote: error: cannot find hook "proc-receive"
52 To <URL/of/upstream.git>
53 ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)
54 ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
55 ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
57 test_cmp expect actual &&
58 git -C "$upstream" show-ref >out &&
59 make_user_friendly_and_stable_output <out >actual &&
61 <COMMIT-A> refs/heads/main
63 test_cmp expect actual