]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5411/test-0012-no-hook-error--porcelain.sh
Merge branch 'es/perf-export-fix'
[thirdparty/git.git] / t / t5411 / test-0012-no-hook-error--porcelain.sh
CommitLineData
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
4test_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 \
15d3af5e
JX
8 >out 2>&1 &&
9 make_user_friendly_and_stable_output <out >actual &&
10 cat >expect <<-EOF &&
11 remote: # pre-receive hook
12 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
a9568dba 13 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
15d3af5e
JX
14 remote: error: cannot find hook "proc-receive"
15 remote: # post-receive hook
16 remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 To <URL/of/upstream.git>
18 * HEAD:refs/heads/next [new branch]
a9568dba 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 &&
23 git -C "$upstream" show-ref >out &&
24 make_user_friendly_and_stable_output <out >actual &&
25 cat >expect <<-EOF &&
a9568dba 26 <COMMIT-A> refs/heads/main
15d3af5e
JX
27 <COMMIT-A> refs/heads/next
28 EOF
29 test_cmp expect actual
30'
31
a9568dba
JS
32# Refs of upstream : main(A) next(A)
33# Refs of workbench: main(A) tags/v123
15d3af5e
JX
34test_expect_success "cleanup ($PROTOCOL/porcelain)" '
35 git -C "$upstream" update-ref -d refs/heads/next
36'
37
a9568dba
JS
38# Refs of upstream : main(A)
39# Refs of workbench: main(A) tags/v123
40# git push --atomic: (B) next(A) refs/for/main/topic(A)
15d3af5e
JX
41test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL/porcelain)" '
42 test_must_fail git -C workbench push --porcelain --atomic origin \
a9568dba 43 $B:main \
15d3af5e 44 HEAD:next \
a9568dba 45 HEAD:refs/for/main/topic >out 2>&1 &&
15d3af5e
JX
46 make_user_friendly_and_stable_output <out >actual &&
47 cat >expect <<-EOF &&
48 remote: # pre-receive hook
a9568dba 49 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
15d3af5e 50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
a9568dba 51 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
15d3af5e
JX
52 remote: error: cannot find hook "proc-receive"
53 To <URL/of/upstream.git>
a9568dba 54 ! <COMMIT-B>:refs/heads/main [remote rejected] (fail to run proc-receive hook)
15d3af5e 55 ! HEAD:refs/heads/next [remote rejected] (fail to run proc-receive hook)
a9568dba 56 ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
15d3af5e
JX
57 Done
58 EOF
59 test_cmp expect actual &&
60 git -C "$upstream" show-ref >out &&
61 make_user_friendly_and_stable_output <out >actual &&
62 cat >expect <<-EOF &&
a9568dba 63 <COMMIT-A> refs/heads/main
15d3af5e
JX
64 EOF
65 test_cmp expect actual
66'