]>
Commit | Line | Data |
---|---|---|
31e8595a JX |
1 | test_expect_success "config receive.procReceiveRefs with modifiers ($PROTOCOL)" ' |
2 | ( | |
3 | cd "$upstream" && | |
4 | git config --unset-all receive.procReceiveRefs && | |
8f0a2645 | 5 | git config --add receive.procReceiveRefs m:refs/heads/main && |
31e8595a JX |
6 | git config --add receive.procReceiveRefs ad:refs/heads && |
7 | git config --add receive.procReceiveRefs "a!:refs/heads" | |
8 | ) | |
9 | ' | |
10 | ||
11 | test_expect_success "setup proc-receive hook ($PROTOCOL)" ' | |
c39176b1 | 12 | test_hook -C "$upstream" --clobber proc-receive <<-EOF |
31e8595a JX |
13 | printf >&2 "# proc-receive hook\n" |
14 | test-tool proc-receive -v \ | |
8f0a2645 | 15 | -r "ok refs/heads/main" \ |
31e8595a JX |
16 | -r "option refname refs/pull/123/head" \ |
17 | -r "option old-oid $A" \ | |
18 | -r "option new-oid $B" \ | |
19 | -r "ok refs/tags/v123 " \ | |
20 | -r "option refname refs/pull/124/head" | |
21 | EOF | |
22 | ' | |
23 | ||
8f0a2645 JS |
24 | # Refs of upstream : main(A) |
25 | # Refs of workbench: main(A) tags/v123 | |
26 | # git push : main(B) tags/v123 | |
31e8595a JX |
27 | test_expect_success "proc-receive: update branch and new tag ($PROTOCOL)" ' |
28 | git -C workbench push origin \ | |
8f0a2645 | 29 | $B:refs/heads/main \ |
31e8595a JX |
30 | v123 >out 2>&1 && |
31 | make_user_friendly_and_stable_output <out >actual && | |
2bafb3d7 JX |
32 | format_and_save_expect <<-EOF && |
33 | > remote: # pre-receive hook Z | |
34 | > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z | |
35 | > remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z | |
36 | > remote: # proc-receive hook Z | |
37 | > remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z | |
38 | > remote: proc-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z | |
39 | > remote: proc-receive> ok refs/heads/main Z | |
40 | > remote: proc-receive> option refname refs/pull/123/head Z | |
41 | > remote: proc-receive> option old-oid <COMMIT-A> Z | |
42 | > remote: proc-receive> option new-oid <COMMIT-B> Z | |
43 | > remote: proc-receive> ok refs/tags/v123 Z | |
44 | > remote: proc-receive> option refname refs/pull/124/head Z | |
45 | > remote: # post-receive hook Z | |
46 | > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head Z | |
47 | > remote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head Z | |
48 | > To <URL/of/upstream.git> | |
12d6991c | 49 | > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> refs/pull/123/head |
2bafb3d7 | 50 | > * [new reference] v123 -> refs/pull/124/head |
31e8595a JX |
51 | EOF |
52 | test_cmp expect actual && | |
822ee894 JX |
53 | |
54 | test_cmp_refs -C "$upstream" <<-EOF | |
8f0a2645 | 55 | <COMMIT-A> refs/heads/main |
31e8595a | 56 | EOF |
31e8595a JX |
57 | ' |
58 | ||
8f0a2645 JS |
59 | # Refs of upstream : main(A) |
60 | # Refs of workbench: main(A) tags/v123 | |
31e8595a JX |
61 | test_expect_success "setup upstream: create tags/v123 ($PROTOCOL)" ' |
62 | git -C "$upstream" update-ref refs/heads/topic $A && | |
63 | git -C "$upstream" update-ref refs/tags/v123 $TAG && | |
822ee894 JX |
64 | |
65 | test_cmp_refs -C "$upstream" <<-EOF | |
8f0a2645 | 66 | <COMMIT-A> refs/heads/main |
31e8595a JX |
67 | <COMMIT-A> refs/heads/topic |
68 | <TAG-v123> refs/tags/v123 | |
69 | EOF | |
31e8595a JX |
70 | ' |
71 | ||
72 | test_expect_success "setup proc-receive hook ($PROTOCOL)" ' | |
c39176b1 | 73 | test_hook -C "$upstream" --clobber proc-receive <<-EOF |
31e8595a JX |
74 | printf >&2 "# proc-receive hook\n" |
75 | test-tool proc-receive -v \ | |
8f0a2645 | 76 | -r "ok refs/heads/main" \ |
31e8595a JX |
77 | -r "option refname refs/pull/123/head" \ |
78 | -r "option old-oid $A" \ | |
79 | -r "option new-oid $ZERO_OID" \ | |
80 | -r "ok refs/heads/next" \ | |
81 | -r "option refname refs/pull/124/head" \ | |
82 | -r "option new-oid $A" | |
83 | EOF | |
84 | ' | |
85 | ||
8f0a2645 JS |
86 | # Refs of upstream : main(A) topic(A) tags/v123 |
87 | # Refs of workbench: main(A) tags/v123 | |
31e8595a JX |
88 | # git push : NULL topic(B) NULL next(A) |
89 | test_expect_success "proc-receive: create/delete branch, and delete tag ($PROTOCOL)" ' | |
90 | git -C workbench push origin \ | |
8f0a2645 | 91 | :refs/heads/main \ |
31e8595a JX |
92 | $B:refs/heads/topic \ |
93 | $A:refs/heads/next \ | |
94 | :refs/tags/v123 >out 2>&1 && | |
95 | make_user_friendly_and_stable_output <out >actual && | |
2bafb3d7 JX |
96 | format_and_save_expect <<-EOF && |
97 | > remote: # pre-receive hook Z | |
98 | > remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/main Z | |
99 | > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic Z | |
100 | > remote: pre-receive< <TAG-v123> <ZERO-OID> refs/tags/v123 Z | |
101 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z | |
102 | > remote: # proc-receive hook Z | |
103 | > remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/main Z | |
104 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z | |
105 | > remote: proc-receive> ok refs/heads/main Z | |
106 | > remote: proc-receive> option refname refs/pull/123/head Z | |
107 | > remote: proc-receive> option old-oid <COMMIT-A> Z | |
108 | > remote: proc-receive> option new-oid <ZERO-OID> Z | |
109 | > remote: proc-receive> ok refs/heads/next Z | |
110 | > remote: proc-receive> option refname refs/pull/124/head Z | |
111 | > remote: proc-receive> option new-oid <COMMIT-A> Z | |
112 | > remote: # post-receive hook Z | |
113 | > remote: post-receive< <COMMIT-A> <ZERO-OID> refs/pull/123/head Z | |
114 | > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic Z | |
115 | > remote: post-receive< <TAG-v123> <ZERO-OID> refs/tags/v123 Z | |
116 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head Z | |
117 | > To <URL/of/upstream.git> | |
118 | > - [deleted] refs/pull/123/head | |
12d6991c | 119 | > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> topic |
2bafb3d7 JX |
120 | > - [deleted] v123 |
121 | > * [new reference] <COMMIT-A> -> refs/pull/124/head | |
31e8595a JX |
122 | EOF |
123 | test_cmp expect actual && | |
822ee894 JX |
124 | |
125 | test_cmp_refs -C "$upstream" <<-EOF | |
8f0a2645 | 126 | <COMMIT-A> refs/heads/main |
31e8595a JX |
127 | <COMMIT-B> refs/heads/topic |
128 | EOF | |
31e8595a | 129 | ' |