]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5411/test-0021-report-ng--porcelain.sh
t5411: use different out file to prevent overwriting
[thirdparty/git.git] / t / t5411 / test-0021-report-ng--porcelain.sh
CommitLineData
15d3af5e
JX
1test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL/porcelain)" '
2 write_script "$upstream/hooks/proc-receive" <<-EOF
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
12test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/porcelain)" '
13 test_must_fail git -C workbench push --porcelain 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 &&
15d3af5e
JX
17 cat >expect <<-EOF &&
18 remote: # pre-receive hook
a9568dba 19 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
15d3af5e 20 remote: # proc-receive hook
a9568dba
JS
21 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 remote: proc-receive> ng refs/for/main/topic
15d3af5e 23 To <URL/of/upstream.git>
a9568dba 24 ! HEAD:refs/for/main/topic [remote rejected] (failed)
15d3af5e
JX
25 Done
26 EOF
27 test_cmp expect actual &&
28 git -C "$upstream" show-ref >out &&
29 make_user_friendly_and_stable_output <out >actual &&
30 cat >expect <<-EOF &&
a9568dba 31 <COMMIT-A> refs/heads/main
15d3af5e
JX
32 EOF
33 test_cmp expect actual
34'
35
36test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)" '
37 write_script "$upstream/hooks/proc-receive" <<-EOF
38 printf >&2 "# proc-receive hook\n"
39 test-tool proc-receive -v \
a9568dba 40 -r "ng refs/for/main/topic error msg"
15d3af5e
JX
41 EOF
42'
43
a9568dba
JS
44# Refs of upstream : main(A)
45# Refs of workbench: main(A) tags/v123
46# git push : refs/for/main/topic
15d3af5e
JX
47test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/porcelain)" '
48 test_must_fail git -C workbench push --porcelain origin \
a9568dba 49 HEAD:refs/for/main/topic \
8388a64c
JX
50 >out-$test_count 2>&1 &&
51 make_user_friendly_and_stable_output <out-$test_count >actual &&
15d3af5e
JX
52 cat >expect <<-EOF &&
53 remote: # pre-receive hook
a9568dba 54 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
15d3af5e 55 remote: # proc-receive hook
a9568dba
JS
56 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
57 remote: proc-receive> ng refs/for/main/topic error msg
15d3af5e 58 To <URL/of/upstream.git>
a9568dba 59 ! HEAD:refs/for/main/topic [remote rejected] (error msg)
15d3af5e
JX
60 Done
61 EOF
62 test_cmp expect actual &&
63 git -C "$upstream" show-ref >out &&
64 make_user_friendly_and_stable_output <out >actual &&
65 cat >expect <<-EOF &&
a9568dba 66 <COMMIT-A> refs/heads/main
15d3af5e
JX
67 EOF
68 test_cmp expect actual
69'