]>
Commit | Line | Data |
---|---|---|
a9568dba JS |
1 | # Refs of upstream : main(A) |
2 | # Refs of workbench: main(A) tags/v123 | |
3 | # git push : next(A) refs/for/main/topic(A) | |
15d3af5e JX |
4 | test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/porcelain)" ' |
5 | test_must_fail git -C workbench push --porcelain origin \ | |
6 | HEAD:next \ | |
a9568dba | 7 | HEAD:refs/for/main/topic \ |
8388a64c JX |
8 | >out-$test_count 2>&1 && |
9 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
10 | format_and_save_expect <<-EOF && |
11 | > remote: # pre-receive hook Z | |
12 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z | |
13 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
14 | > remote: error: cannot find hook "proc-receive" Z | |
15 | > remote: # post-receive hook Z | |
16 | > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z | |
17 | > To <URL/of/upstream.git> | |
18 | > * HEAD:refs/heads/next [new branch] | |
19 | > ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook) | |
15d3af5e JX |
20 | Done |
21 | EOF | |
22 | test_cmp expect actual && | |
822ee894 JX |
23 | |
24 | test_cmp_refs -C "$upstream" <<-EOF | |
a9568dba | 25 | <COMMIT-A> refs/heads/main |
15d3af5e JX |
26 | <COMMIT-A> refs/heads/next |
27 | EOF | |
15d3af5e JX |
28 | ' |
29 | ||
a9568dba JS |
30 | # Refs of upstream : main(A) next(A) |
31 | # Refs of workbench: main(A) tags/v123 | |
15d3af5e JX |
32 | test_expect_success "cleanup ($PROTOCOL/porcelain)" ' |
33 | git -C "$upstream" update-ref -d refs/heads/next | |
34 | ' | |
35 | ||
a9568dba JS |
36 | # Refs of upstream : main(A) |
37 | # Refs of workbench: main(A) tags/v123 | |
38 | # git push --atomic: (B) next(A) refs/for/main/topic(A) | |
15d3af5e JX |
39 | test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL/porcelain)" ' |
40 | test_must_fail git -C workbench push --porcelain --atomic origin \ | |
a9568dba | 41 | $B:main \ |
15d3af5e | 42 | HEAD:next \ |
8388a64c JX |
43 | HEAD:refs/for/main/topic >out-$test_count 2>&1 && |
44 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
45 | format_and_save_expect <<-EOF && |
46 | > remote: # pre-receive hook Z | |
47 | > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z | |
48 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z | |
49 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
50 | > remote: error: cannot find hook "proc-receive" Z | |
51 | > To <URL/of/upstream.git> | |
52 | > ! <COMMIT-B>:refs/heads/main [remote rejected] (fail to run proc-receive hook) | |
53 | > ! HEAD:refs/heads/next [remote rejected] (fail to run proc-receive hook) | |
54 | > ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook) | |
55 | > Done | |
15d3af5e JX |
56 | EOF |
57 | test_cmp expect actual && | |
822ee894 JX |
58 | |
59 | test_cmp_refs -C "$upstream" <<-EOF | |
a9568dba | 60 | <COMMIT-A> refs/heads/main |
15d3af5e | 61 | EOF |
15d3af5e | 62 | ' |