Merge branch 'es/tutorial-mention-asciidoc-early'
[git] / t / t5411 / test-0003-pre-receive-declined--porcelain.sh
1 test_expect_success "setup pre-receive hook ($PROTOCOL/porcelain)" '
2         mv "$upstream/hooks/pre-receive" "$upstream/hooks/pre-receive.ok" &&
3         write_script "$upstream/hooks/pre-receive" <<-EOF
4         exit 1
5         EOF
6 '
7
8 # Refs of upstream : master(A)
9 # Refs of workbench: master(A)  tags/v123
10 # git-push         : master(B)             next(A)
11 test_expect_success "git-push is declined ($PROTOCOL/porcelain)" '
12         test_must_fail git -C workbench push --porcelain origin \
13                 $B:refs/heads/master \
14                 HEAD:refs/heads/next \
15                 >out 2>&1 &&
16         make_user_friendly_and_stable_output <out >actual &&
17         cat >expect <<-EOF &&
18         To <URL/of/upstream.git>
19         !    <COMMIT-B>:refs/heads/master    [remote rejected] (pre-receive hook declined)
20         !    HEAD:refs/heads/next    [remote rejected] (pre-receive hook declined)
21         Done
22         EOF
23         test_cmp expect actual &&
24         git -C "$upstream" show-ref >out &&
25         make_user_friendly_and_stable_output <out >actual &&
26         cat >expect <<-EOF &&
27         <COMMIT-A> refs/heads/master
28         EOF
29         test_cmp expect actual
30 '
31
32 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
33         mv "$upstream/hooks/pre-receive.ok" "$upstream/hooks/pre-receive"
34 '