1 test_expect_success "setup proc-receive hook and disable push-options ($PROTOCOL/porcelain)" '
2 git -C "$upstream" config receive.advertisePushOptions false &&
3 write_script "$upstream/hooks/proc-receive" <<-EOF
4 printf >&2 "# proc-receive hook\n"
5 test-tool proc-receive -v \
6 -r "ok refs/for/main/topic"
10 # Refs of upstream : main(A)
11 # Refs of workbench: main(A) tags/v123
12 # git push -o ... : refs/for/main/topic
13 test_expect_success "proc-receive: not support push options ($PROTOCOL/porcelain)" '
14 test_must_fail git -C workbench push \
19 HEAD:refs/for/main/topic \
21 make_user_friendly_and_stable_output <out >actual &&
22 test_i18ngrep "fatal: the receiving end does not support push options" \
24 git -C "$upstream" show-ref >out &&
25 make_user_friendly_and_stable_output <out >actual &&
27 <COMMIT-A> refs/heads/main
29 test_cmp expect actual
32 test_expect_success "enable push options ($PROTOCOL/porcelain)" '
33 git -C "$upstream" config receive.advertisePushOptions true
36 # Refs of upstream : main(A)
37 # Refs of workbench: main(A) tags/v123
38 # git push -o ... : next(A) refs/for/main/topic
39 test_expect_success "proc-receive: push with options ($PROTOCOL/porcelain)" '
40 git -C workbench push \
46 HEAD:refs/heads/next \
47 HEAD:refs/for/main/topic \
49 make_user_friendly_and_stable_output <out >actual &&
51 remote: # pre-receive hook
52 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
53 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
54 remote: # proc-receive hook
55 remote: proc-receive: atomic push_options
56 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
57 remote: proc-receive< issue=123
58 remote: proc-receive< reviewer=user1
59 remote: proc-receive> ok refs/for/main/topic
60 remote: # post-receive hook
61 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
62 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
63 To <URL/of/upstream.git>
64 * HEAD:refs/heads/next [new branch]
65 * HEAD:refs/for/main/topic [new reference]
68 test_cmp expect actual &&
69 git -C "$upstream" show-ref >out &&
70 make_user_friendly_and_stable_output <out >actual &&
72 <COMMIT-A> refs/heads/main
73 <COMMIT-A> refs/heads/next
75 test_cmp expect actual
78 # Refs of upstream : main(A) next(A)
79 # Refs of workbench: main(A) tags/v123
80 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
81 git -C "$upstream" update-ref -d refs/heads/next