]>
Commit | Line | Data |
---|---|---|
15d3af5e | 1 | test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL)" ' |
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 \ | |
a9568dba | 5 | -r "ng refs/for/main/topic" |
15d3af5e JX |
6 | EOF |
7 | ' | |
8 | ||
a9568dba JS |
9 | # Refs of upstream : main(A) |
10 | # Refs of workbench: main(A) tags/v123 | |
11 | # git push : refs/for/main/topic | |
15d3af5e JX |
12 | test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" ' |
13 | test_must_fail git -C workbench push origin \ | |
a9568dba | 14 | HEAD:refs/for/main/topic \ |
8388a64c JX |
15 | >out-$test_count 2>&1 && |
16 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
17 | format_and_save_expect <<-EOF && |
18 | > remote: # pre-receive hook Z | |
19 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
20 | > remote: # proc-receive hook Z | |
21 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
22 | > remote: proc-receive> ng refs/for/main/topic Z | |
23 | > To <URL/of/upstream.git> | |
24 | > ! [remote rejected] HEAD -> refs/for/main/topic (failed) | |
15d3af5e JX |
25 | EOF |
26 | test_cmp expect actual && | |
822ee894 JX |
27 | |
28 | test_cmp_refs -C "$upstream" <<-EOF | |
a9568dba | 29 | <COMMIT-A> refs/heads/main |
15d3af5e | 30 | EOF |
15d3af5e JX |
31 | ' |
32 | ||
33 | test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" ' | |
c39176b1 | 34 | test_hook -C "$upstream" --clobber proc-receive <<-\EOF |
15d3af5e JX |
35 | printf >&2 "# proc-receive hook\n" |
36 | test-tool proc-receive -v \ | |
a9568dba | 37 | -r "ng refs/for/main/topic error msg" |
15d3af5e JX |
38 | EOF |
39 | ' | |
40 | ||
a9568dba JS |
41 | # Refs of upstream : main(A) |
42 | # Refs of workbench: main(A) tags/v123 | |
43 | # git push : refs/for/main/topic | |
15d3af5e JX |
44 | test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)" ' |
45 | test_must_fail git -C workbench push origin \ | |
a9568dba | 46 | HEAD:refs/for/main/topic \ |
8388a64c JX |
47 | >out-$test_count 2>&1 && |
48 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
49 | format_and_save_expect <<-EOF && |
50 | > remote: # pre-receive hook Z | |
51 | > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
52 | > remote: # proc-receive hook Z | |
53 | > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z | |
54 | > remote: proc-receive> ng refs/for/main/topic error msg Z | |
55 | > To <URL/of/upstream.git> | |
56 | > ! [remote rejected] HEAD -> refs/for/main/topic (error msg) | |
15d3af5e JX |
57 | EOF |
58 | test_cmp expect actual && | |
822ee894 JX |
59 | |
60 | test_cmp_refs -C "$upstream" <<-EOF | |
a9568dba | 61 | <COMMIT-A> refs/heads/main |
15d3af5e | 62 | EOF |
15d3af5e | 63 | ' |