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/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/porcelain)" '
13 test_must_fail git -C workbench push --porcelain origin \
14 HEAD:refs/for/main/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >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 ! HEAD:refs/for/main/topic [remote rejected] (failed)
27 test_cmp expect actual &&
29 test_cmp_refs -C "$upstream" <<-EOF
30 <COMMIT-A> refs/heads/main
34 test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)" '
35 write_script "$upstream/hooks/proc-receive" <<-EOF
36 printf >&2 "# proc-receive hook\n"
37 test-tool proc-receive -v \
38 -r "ng refs/for/main/topic error msg"
42 # Refs of upstream : main(A)
43 # Refs of workbench: main(A) tags/v123
44 # git push : refs/for/main/topic
45 test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/porcelain)" '
46 test_must_fail git -C workbench push --porcelain origin \
47 HEAD:refs/for/main/topic \
48 >out-$test_count 2>&1 &&
49 make_user_friendly_and_stable_output <out-$test_count >actual &&
51 remote: # pre-receive hook
52 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
53 remote: # proc-receive hook
54 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
55 remote: proc-receive> ng refs/for/main/topic error msg
56 To <URL/of/upstream.git>
57 ! HEAD:refs/for/main/topic [remote rejected] (error msg)
60 test_cmp expect actual &&
62 test_cmp_refs -C "$upstream" <<-EOF
63 <COMMIT-A> refs/heads/main