]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5411/test-0011-no-hook-error.sh
annotate-tests: quote variable expansions containing path names
[thirdparty/git.git] / t / t5411 / test-0011-no-hook-error.sh
1 # Refs of upstream : master(A)
2 # Refs of workbench: master(A) tags/v123
3 # git push : next(A) refs/for/master/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/master/topic \
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
13 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
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
19 ! [remote rejected] HEAD -> refs/for/master/topic (fail to run proc-receive hook)
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 &&
25 <COMMIT-A> refs/heads/master
26 <COMMIT-A> refs/heads/next
27 EOF
28 test_cmp expect actual
29 '
30
31 # Refs of upstream : master(A) next(A)
32 # Refs of workbench: master(A) tags/v123
33 test_expect_success "cleanup ($PROTOCOL)" '
34 git -C "$upstream" update-ref -d refs/heads/next
35 '
36
37 # Refs of upstream : master(A)
38 # Refs of workbench: master(A) tags/v123
39 # git push --atomic: (B) next(A) refs/for/master/topic(A)
40 test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCOL)" '
41 test_must_fail git -C workbench push --atomic origin \
42 $B:master \
43 HEAD:next \
44 HEAD:refs/for/master/topic >out 2>&1 &&
45 make_user_friendly_and_stable_output <out >actual &&
46 cat >expect <<-EOF &&
47 remote: # pre-receive hook
48 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/master
49 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
50 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
51 remote: error: cannot find hook "proc-receive"
52 To <URL/of/upstream.git>
53 ! [remote rejected] <COMMIT-B> -> master (fail to run proc-receive hook)
54 ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
55 ! [remote rejected] HEAD -> refs/for/master/topic (fail to run proc-receive hook)
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 &&
61 <COMMIT-A> refs/heads/master
62 EOF
63 test_cmp expect actual
64 '