The second batch
[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         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/main/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/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         cat >expect <<-EOF &&
45         remote: # pre-receive hook
46         remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
47         remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
48         remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
49         remote: error: cannot find hook "proc-receive"
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 '