]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5411/test-0011-no-hook-error.sh
Merge branch 'xx/rfc2822-date-format-in-doc'
[thirdparty/git.git] / t / t5411 / test-0011-no-hook-error.sh
1 # Refs of upstream : main(A)
2 # Refs of workbench: main(A) tags/v123
3 # git push : next(A) refs/for/main/topic(A)
4 test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL)" '
5 test_must_fail git -C workbench push origin \
6 HEAD:next \
7 HEAD:refs/for/main/topic \
8 >out-$test_count 2>&1 &&
9 make_user_friendly_and_stable_output <out-$test_count >actual &&
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)
20 EOF
21 test_cmp expect actual &&
22
23 test_cmp_refs -C "$upstream" <<-EOF
24 <COMMIT-A> refs/heads/main
25 <COMMIT-A> refs/heads/next
26 EOF
27 '
28
29 # Refs of upstream : main(A) next(A)
30 # Refs of workbench: main(A) tags/v123
31 test_expect_success "cleanup ($PROTOCOL)" '
32 git -C "$upstream" update-ref -d refs/heads/next
33 '
34
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)
38 test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL)" '
39 test_must_fail git -C workbench push --atomic origin \
40 $B:main \
41 HEAD:next \
42 HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
43 make_user_friendly_and_stable_output <out-$test_count >actual &&
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)
54 EOF
55 test_cmp expect actual &&
56
57 test_cmp_refs -C "$upstream" <<-EOF
58 <COMMIT-A> refs/heads/main
59 EOF
60 '