1 test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL/porcelain)" '
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/master/topic"
9 # Refs of upstream : master(A)
10 # Refs of workbench: master(A) tags/v123
11 # git push : refs/for/master/topic
12 test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/porcelain)" '
13 test_must_fail git -C workbench push --porcelain origin \
14 HEAD:refs/for/master/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/master/topic
20 remote: # proc-receive hook
21 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
22 remote: proc-receive> ng refs/for/master/topic
23 To <URL/of/upstream.git>
24 ! HEAD:refs/for/master/topic [remote rejected] (failed)
27 test_cmp expect actual &&
28 git -C "$upstream" show-ref >out &&
29 make_user_friendly_and_stable_output <out >actual &&
31 <COMMIT-A> refs/heads/master
33 test_cmp expect actual
36 test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)" '
37 write_script "$upstream/hooks/proc-receive" <<-EOF
38 printf >&2 "# proc-receive hook\n"
39 test-tool proc-receive -v \
40 -r "ng refs/for/master/topic error msg"
44 # Refs of upstream : master(A)
45 # Refs of workbench: master(A) tags/v123
46 # git push : refs/for/master/topic
47 test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/porcelain)" '
48 test_must_fail git -C workbench push --porcelain origin \
49 HEAD:refs/for/master/topic \
51 make_user_friendly_and_stable_output <out >actual &&
53 remote: # pre-receive hook
54 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
55 remote: # proc-receive hook
56 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
57 remote: proc-receive> ng refs/for/master/topic error msg
58 To <URL/of/upstream.git>
59 ! HEAD:refs/for/master/topic [remote rejected] (error msg)
62 test_cmp expect actual &&
63 git -C "$upstream" show-ref >out &&
64 make_user_friendly_and_stable_output <out >actual &&
66 <COMMIT-A> refs/heads/master
68 test_cmp expect actual