]>
Commit | Line | Data |
---|---|---|
15d3af5e | 1 | test_expect_success "setup proc-receive hook ($PROTOCOL/porcelain)" ' |
c39176b1 | 2 | test_hook -C "$upstream" --clobber proc-receive <<-EOF |
15d3af5e JX |
3 | printf >&2 "# proc-receive hook\n" |
4 | test-tool proc-receive -v \ | |
5 | -r "ok refs/for/next/topic2" \ | |
6 | -r "ng refs/for/next/topic1 fail to call Web API" \ | |
8f0a2645 JS |
7 | -r "ok refs/for/main/topic" \ |
8 | -r "option refname refs/for/main/topic" \ | |
15d3af5e JX |
9 | -r "option old-oid $A" \ |
10 | -r "option new-oid $B" | |
11 | EOF | |
12 | ' | |
13 | ||
8f0a2645 JS |
14 | # Refs of upstream : main(A) |
15 | # Refs of workbench: main(A) tags/v123 | |
16 | # git push : (B) bar(A) baz(A) refs/for/next/topic(A) foo(A) refs/for/main/topic(A) | |
15d3af5e JX |
17 | test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcelain)" ' |
18 | test_must_fail git -C workbench push --porcelain origin \ | |
8f0a2645 | 19 | $B:refs/heads/main \ |
15d3af5e JX |
20 | HEAD:refs/heads/bar \ |
21 | HEAD:refs/heads/baz \ | |
22 | HEAD:refs/for/next/topic2 \ | |
23 | HEAD:refs/for/next/topic1 \ | |
24 | HEAD:refs/heads/foo \ | |
8f0a2645 | 25 | HEAD:refs/for/main/topic \ |
15d3af5e | 26 | HEAD:refs/for/next/topic3 \ |
8388a64c JX |
27 | >out-$test_count 2>&1 && |
28 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
29 | format_and_save_expect <<-EOF && |
30 | > remote: # pre-receive hook Z | |
31 | > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z | |
32 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z | |
33 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z | |
34 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z | |
35 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z | |
36 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z | |
37 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
38 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z | |
39 | > remote: # proc-receive hook Z | |
40 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z | |
41 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z | |
42 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
43 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z | |
44 | > remote: proc-receive> ok refs/for/next/topic2 Z | |
45 | > remote: proc-receive> ng refs/for/next/topic1 fail to call Web API Z | |
46 | > remote: proc-receive> ok refs/for/main/topic Z | |
47 | > remote: proc-receive> option refname refs/for/main/topic Z | |
48 | > remote: proc-receive> option old-oid <COMMIT-A> Z | |
49 | > remote: proc-receive> option new-oid <COMMIT-B> Z | |
50 | > remote: # post-receive hook Z | |
51 | > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z | |
52 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z | |
53 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z | |
54 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z | |
55 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z | |
56 | > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z | |
57 | > To <URL/of/upstream.git> | |
12d6991c | 58 | > <COMMIT-B>:refs/heads/main <COMMIT-A>..<COMMIT-B> |
2bafb3d7 JX |
59 | > * HEAD:refs/heads/bar [new branch] |
60 | > * HEAD:refs/heads/baz [new branch] | |
61 | > * HEAD:refs/for/next/topic2 [new reference] | |
62 | > * HEAD:refs/heads/foo [new branch] | |
12d6991c | 63 | > HEAD:refs/for/main/topic <COMMIT-A>..<COMMIT-B> |
2bafb3d7 JX |
64 | > ! HEAD:refs/for/next/topic1 [remote rejected] (fail to call Web API) |
65 | > ! HEAD:refs/for/next/topic3 [remote rejected] (proc-receive failed to report status) | |
66 | > Done | |
15d3af5e JX |
67 | EOF |
68 | test_cmp expect actual && | |
822ee894 JX |
69 | |
70 | test_cmp_refs -C "$upstream" <<-EOF | |
15d3af5e JX |
71 | <COMMIT-A> refs/heads/bar |
72 | <COMMIT-A> refs/heads/baz | |
73 | <COMMIT-A> refs/heads/foo | |
8f0a2645 | 74 | <COMMIT-B> refs/heads/main |
15d3af5e | 75 | EOF |
15d3af5e JX |
76 | ' |
77 | ||
8f0a2645 JS |
78 | # Refs of upstream : main(B) foo(A) bar(A)) baz(A) |
79 | # Refs of workbench: main(A) tags/v123 | |
15d3af5e JX |
80 | test_expect_success "cleanup ($PROTOCOL/porcelain)" ' |
81 | ( | |
82 | cd "$upstream" && | |
8f0a2645 | 83 | git update-ref refs/heads/main $A && |
15d3af5e JX |
84 | git update-ref -d refs/heads/foo && |
85 | git update-ref -d refs/heads/bar && | |
86 | git update-ref -d refs/heads/baz | |
87 | ) | |
88 | ||
89 | ' |