1 test_expect_success "setup receive.procReceiveRefs" '
2 git -C "$upstream" config --add receive.procReceiveRefs refs/for
5 test_expect_success "setup proc-receive hook" '
6 write_script "$upstream/hooks/proc-receive" <<-EOF
7 printf >&2 "# proc-receive hook\n"
8 test-tool proc-receive -v \
9 -r "ok refs/for/master/topic1" \
10 -r "option fall-through" \
11 -r "ok refs/for/master/topic2" \
12 -r "option refname refs/for/changes/23/123/1" \
13 -r "option new-oid $A" \
14 -r "ok refs/for/master/topic2" \
15 -r "option refname refs/for/changes/24/124/2" \
16 -r "option old-oid $B" \
17 -r "option new-oid $A" \
18 -r "option forced-update" \
19 -r "ng refs/for/next/topic target branch not exist"
23 # Refs of upstream : master(A)
24 # Refs of workbench: master(A) tags/v123
25 # git push : (B) refs/for/master/topic1(A) foo(A) refs/for/next/topic(A) refs/for/master/topic2(A)
26 test_expect_success "proc-receive: report status v1" '
28 if test -z "$GIT_DEFAULT_HASH" || test "$GIT_DEFAULT_HASH" = "sha1"
30 printf "%s %s refs/heads/master\0report-status\n" \
33 printf "%s %s refs/heads/master\0report-status object-format=$GIT_DEFAULT_HASH\n" \
36 printf "%s %s refs/for/master/topic1\n" \
37 $ZERO_OID $A | packetize &&
38 printf "%s %s refs/heads/foo\n" \
39 $ZERO_OID $A | packetize &&
40 printf "%s %s refs/for/next/topic\n" \
41 $ZERO_OID $A | packetize &&
42 printf "%s %s refs/for/master/topic2\n" \
43 $ZERO_OID $A | packetize &&
45 printf "" | git -C "$upstream" pack-objects --stdout
46 } | git receive-pack "$upstream" --stateless-rpc \
48 make_user_friendly_and_stable_output <out >actual &&
51 pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/master
52 pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic1
53 pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
54 pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
55 pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic2
57 proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic1
58 proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
59 proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic2
60 proc-receive> ok refs/for/master/topic1
61 proc-receive> option fall-through
62 proc-receive> ok refs/for/master/topic2
63 proc-receive> option refname refs/for/changes/23/123/1
64 proc-receive> option new-oid <COMMIT-A>
65 proc-receive> ok refs/for/master/topic2
66 proc-receive> option refname refs/for/changes/24/124/2
67 proc-receive> option old-oid <COMMIT-B>
68 proc-receive> option new-oid <COMMIT-A>
69 proc-receive> option forced-update
70 proc-receive> ng refs/for/next/topic target branch not exist
72 0019ok refs/heads/master
73 001eok refs/for/master/topic1
75 0033ng refs/for/next/topic target branch not exist
76 001eok refs/for/master/topic2
77 0000# post-receive hook
78 post-receive< <COMMIT-A> <COMMIT-B> refs/heads/master
79 post-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic1
80 post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
81 post-receive< <ZERO-OID> <COMMIT-A> refs/for/changes/23/123/1
82 post-receive< <COMMIT-B> <COMMIT-A> refs/for/changes/24/124/2
84 test_cmp expect actual &&
86 git -C "$upstream" show-ref >out &&
87 make_user_friendly_and_stable_output <out >actual &&
89 <COMMIT-A> refs/for/master/topic1
90 <COMMIT-A> refs/heads/foo
91 <COMMIT-B> refs/heads/master
93 test_cmp expect actual