1 test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL)" '
2 write_script "$upstream/hooks/proc-receive" <<-EOF
3 printf >&2 "# proc-receive hook\n"
4 test-tool proc-receive -v \
5 -r "ng refs/for/main/topic"
9 # Refs of upstream : main(A)
10 # Refs of workbench: main(A) tags/v123
11 # git push : refs/for/main/topic
12 test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
13 test_must_fail git -C workbench push origin \
14 HEAD:refs/for/main/topic \
16 make_user_friendly_and_stable_output <out >actual &&
18 remote: # pre-receive hook
19 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 remote: # proc-receive hook
21 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 remote: proc-receive> ng refs/for/main/topic
23 To <URL/of/upstream.git>
24 ! [remote rejected] HEAD -> refs/for/main/topic (failed)
26 test_cmp expect actual &&
27 git -C "$upstream" show-ref >out &&
28 make_user_friendly_and_stable_output <out >actual &&
30 <COMMIT-A> refs/heads/main
32 test_cmp expect actual
35 test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" '
36 write_script "$upstream/hooks/proc-receive" <<-EOF
37 printf >&2 "# proc-receive hook\n"
38 test-tool proc-receive -v \
39 -r "ng refs/for/main/topic error msg"
43 # Refs of upstream : main(A)
44 # Refs of workbench: main(A) tags/v123
45 # git push : refs/for/main/topic
46 test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)" '
47 test_must_fail git -C workbench push origin \
48 HEAD:refs/for/main/topic \
50 make_user_friendly_and_stable_output <out >actual &&
52 remote: # pre-receive hook
53 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
54 remote: # proc-receive hook
55 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
56 remote: proc-receive> ng refs/for/main/topic error msg
57 To <URL/of/upstream.git>
58 ! [remote rejected] HEAD -> refs/for/main/topic (error msg)
60 test_cmp expect actual &&
61 git -C "$upstream" show-ref >out &&
62 make_user_friendly_and_stable_output <out >actual &&
64 <COMMIT-A> refs/heads/main
66 test_cmp expect actual