]>
Commit | Line | Data |
---|---|---|
31e8595a JX |
1 | test_expect_success "config receive.procReceiveRefs = refs ($PROTOCOL)" ' |
2 | git -C "$upstream" config --unset-all receive.procReceiveRefs && | |
3 | git -C "$upstream" config --add receive.procReceiveRefs refs | |
4 | ' | |
5 | ||
8f0a2645 JS |
6 | # Refs of upstream : main(A) |
7 | # Refs of workbench: main(A) tags/v123 | |
31e8595a JX |
8 | test_expect_success "setup upstream branches ($PROTOCOL)" ' |
9 | ( | |
10 | cd "$upstream" && | |
8f0a2645 | 11 | git update-ref refs/heads/main $B && |
31e8595a JX |
12 | git update-ref refs/heads/foo $A && |
13 | git update-ref refs/heads/bar $A && | |
14 | git update-ref refs/heads/baz $A | |
15 | ) | |
16 | ||
17 | ' | |
18 | ||
19 | test_expect_success "setup proc-receive hook ($PROTOCOL)" ' | |
20 | write_script "$upstream/hooks/proc-receive" <<-EOF | |
21 | printf >&2 "# proc-receive hook\n" | |
22 | test-tool proc-receive -v \ | |
8f0a2645 | 23 | -r "ok refs/heads/main" \ |
31e8595a JX |
24 | -r "option fall-through" \ |
25 | -r "ok refs/heads/foo" \ | |
26 | -r "option fall-through" \ | |
27 | -r "ok refs/heads/bar" \ | |
28 | -r "option fall-through" \ | |
8f0a2645 | 29 | -r "ok refs/for/main/topic" \ |
31e8595a JX |
30 | -r "option refname refs/pull/123/head" \ |
31 | -r "option old-oid $A" \ | |
32 | -r "option new-oid $B" \ | |
33 | -r "ok refs/for/next/topic" \ | |
34 | -r "option refname refs/pull/124/head" \ | |
35 | -r "option old-oid $B" \ | |
36 | -r "option new-oid $A" \ | |
37 | -r "option forced-update" | |
38 | EOF | |
39 | ' | |
40 | ||
8f0a2645 JS |
41 | # Refs of upstream : main(B) foo(A) bar(A)) baz(A) |
42 | # Refs of workbench: main(A) tags/v123 | |
43 | # git push -f : main(A) (NULL) (B) refs/for/main/topic(A) refs/for/next/topic(A) | |
31e8595a JX |
44 | test_expect_success "proc-receive: process all refs ($PROTOCOL)" ' |
45 | git -C workbench push -f origin \ | |
8f0a2645 | 46 | HEAD:refs/heads/main \ |
31e8595a JX |
47 | :refs/heads/foo \ |
48 | $B:refs/heads/bar \ | |
8f0a2645 | 49 | HEAD:refs/for/main/topic \ |
31e8595a JX |
50 | HEAD:refs/for/next/topic \ |
51 | >out 2>&1 && | |
52 | make_user_friendly_and_stable_output <out >actual && | |
53 | cat >expect <<-EOF && | |
54 | remote: # pre-receive hook | |
55 | remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar | |
56 | remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo | |
8f0a2645 JS |
57 | remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main |
58 | remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic | |
31e8595a JX |
59 | remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic |
60 | remote: # proc-receive hook | |
61 | remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar | |
62 | remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo | |
8f0a2645 JS |
63 | remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main |
64 | remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic | |
31e8595a | 65 | remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic |
8f0a2645 | 66 | remote: proc-receive> ok refs/heads/main |
31e8595a JX |
67 | remote: proc-receive> option fall-through |
68 | remote: proc-receive> ok refs/heads/foo | |
69 | remote: proc-receive> option fall-through | |
70 | remote: proc-receive> ok refs/heads/bar | |
71 | remote: proc-receive> option fall-through | |
8f0a2645 | 72 | remote: proc-receive> ok refs/for/main/topic |
31e8595a JX |
73 | remote: proc-receive> option refname refs/pull/123/head |
74 | remote: proc-receive> option old-oid <COMMIT-A> | |
75 | remote: proc-receive> option new-oid <COMMIT-B> | |
76 | remote: proc-receive> ok refs/for/next/topic | |
77 | remote: proc-receive> option refname refs/pull/124/head | |
78 | remote: proc-receive> option old-oid <COMMIT-B> | |
79 | remote: proc-receive> option new-oid <COMMIT-A> | |
80 | remote: proc-receive> option forced-update | |
81 | remote: # post-receive hook | |
82 | remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar | |
83 | remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo | |
8f0a2645 | 84 | remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main |
31e8595a JX |
85 | remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head |
86 | remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head | |
87 | To <URL/of/upstream.git> | |
88 | <OID-A>..<OID-B> <COMMIT-B> -> bar | |
89 | - [deleted] foo | |
8f0a2645 | 90 | + <OID-B>...<OID-A> HEAD -> main (forced update) |
31e8595a JX |
91 | <OID-A>..<OID-B> HEAD -> refs/pull/123/head |
92 | + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update) | |
93 | EOF | |
94 | test_cmp expect actual && | |
95 | git -C "$upstream" show-ref >out && | |
96 | make_user_friendly_and_stable_output <out >actual && | |
97 | cat >expect <<-EOF && | |
98 | <COMMIT-B> refs/heads/bar | |
99 | <COMMIT-A> refs/heads/baz | |
8f0a2645 | 100 | <COMMIT-A> refs/heads/main |
31e8595a JX |
101 | EOF |
102 | test_cmp expect actual | |
103 | ' | |
104 | ||
8f0a2645 JS |
105 | # Refs of upstream : main(A) bar(A) baz(B) |
106 | # Refs of workbench: main(A) tags/v123 | |
31e8595a JX |
107 | test_expect_success "cleanup ($PROTOCOL)" ' |
108 | ( | |
109 | cd "$upstream" && | |
110 | git update-ref -d refs/heads/bar && | |
111 | git update-ref -d refs/heads/baz | |
112 | ) | |
113 | ' |