]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5411/test-0011-no-hook-error.sh
Merge branch 'fc/t6030-bisect-reset-removes-auxiliary-files'
[thirdparty/git.git] / t / t5411 / test-0011-no-hook-error.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)" '
5 test_must_fail git -C workbench push 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 * [new branch] HEAD -> next
a9568dba 19 ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
15d3af5e
JX
20 EOF
21 test_cmp expect actual &&
22 git -C "$upstream" show-ref >out &&
23 make_user_friendly_and_stable_output <out >actual &&
24 cat >expect <<-EOF &&
a9568dba 25 <COMMIT-A> refs/heads/main
15d3af5e
JX
26 <COMMIT-A> refs/heads/next
27 EOF
28 test_cmp expect actual
29'
30
a9568dba
JS
31# Refs of upstream : main(A) next(A)
32# Refs of workbench: main(A) tags/v123
15d3af5e
JX
33test_expect_success "cleanup ($PROTOCOL)" '
34 git -C "$upstream" update-ref -d refs/heads/next
35'
36
a9568dba
JS
37# Refs of upstream : main(A)
38# Refs of workbench: main(A) tags/v123
39# git push --atomic: (B) next(A) refs/for/main/topic(A)
15d3af5e
JX
40test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL)" '
41 test_must_fail git -C workbench push --atomic origin \
a9568dba 42 $B:main \
15d3af5e 43 HEAD:next \
a9568dba 44 HEAD:refs/for/main/topic >out 2>&1 &&
15d3af5e
JX
45 make_user_friendly_and_stable_output <out >actual &&
46 cat >expect <<-EOF &&
47 remote: # pre-receive hook
a9568dba 48 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
15d3af5e 49 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
a9568dba 50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
15d3af5e
JX
51 remote: error: cannot find hook "proc-receive"
52 To <URL/of/upstream.git>
a9568dba 53 ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)
15d3af5e 54 ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
a9568dba 55 ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
15d3af5e
JX
56 EOF
57 test_cmp expect actual &&
58 git -C "$upstream" show-ref >out &&
59 make_user_friendly_and_stable_output <out >actual &&
60 cat >expect <<-EOF &&
a9568dba 61 <COMMIT-A> refs/heads/main
15d3af5e
JX
62 EOF
63 test_cmp expect actual
64'