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