1 test_expect_success "setup proc-receive hook and disable push-options ($PROTOCOL)" '
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/master/topic"
10 # Refs of upstream : master(A)
11 # Refs of workbench: master(A) tags/v123
12 # git push -o ... : refs/for/master/topic
13 test_expect_success "proc-receive: not support push options ($PROTOCOL)" '
14 test_must_fail git -C workbench push \
18 HEAD:refs/for/master/topic \
20 make_user_friendly_and_stable_output <out >actual &&
21 test_i18ngrep "fatal: the receiving end does not support push options" \
23 git -C "$upstream" show-ref >out &&
24 make_user_friendly_and_stable_output <out >actual &&
26 <COMMIT-A> refs/heads/master
28 test_cmp expect actual
31 test_expect_success "enable push options ($PROTOCOL)" '
32 git -C "$upstream" config receive.advertisePushOptions true
35 # Refs of upstream : master(A)
36 # Refs of workbench: master(A) tags/v123
37 # git push -o ... : next(A) refs/for/master/topic
38 test_expect_success "proc-receive: push with options ($PROTOCOL)" '
39 git -C workbench push \
44 HEAD:refs/heads/next \
45 HEAD:refs/for/master/topic \
47 make_user_friendly_and_stable_output <out >actual &&
49 remote: # pre-receive hook
50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
51 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
52 remote: # proc-receive hook
53 remote: proc-receive: atomic push_options
54 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
55 remote: proc-receive< issue=123
56 remote: proc-receive< reviewer=user1
57 remote: proc-receive> ok refs/for/master/topic
58 remote: # post-receive hook
59 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
60 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
61 To <URL/of/upstream.git>
62 * [new branch] HEAD -> next
63 * [new reference] HEAD -> refs/for/master/topic
65 test_cmp expect actual &&
66 git -C "$upstream" show-ref >out &&
67 make_user_friendly_and_stable_output <out >actual &&
69 <COMMIT-A> refs/heads/master
70 <COMMIT-A> refs/heads/next
72 test_cmp expect actual
75 # Refs of upstream : master(A) next(A)
76 # Refs of workbench: master(A) tags/v123
77 test_expect_success "cleanup ($PROTOCOL)" '
78 git -C "$upstream" update-ref -d refs/heads/next