Merge branch 'js/test-whitespace-fixes'
[git] / t / t5411 / test-0035-report-ft--porcelain.sh
1 test_expect_success "setup proc-receive hook (fall-through, $PROTOCOL/porcelain)" '
2         write_script "$upstream/hooks/proc-receive" <<-EOF
3         printf >&2 "# proc-receive hook\n"
4         test-tool proc-receive -v \
5                 -r "ok refs/for/main/topic" \
6                 -r "option fall-through"
7         EOF
8 '
9
10 # Refs of upstream : main(A)
11 # Refs of workbench: main(A)  tags/v123
12 # git push         :                       refs/for/main/topic(B)
13 test_expect_success "proc-receive: fall throught, let receive-pack to execute ($PROTOCOL/porcelain)" '
14         git -C workbench push --porcelain origin \
15                 $B:refs/for/main/topic \
16                 >out 2>&1 &&
17         make_user_friendly_and_stable_output <out >actual &&
18         cat >expect <<-EOF &&
19         remote: # pre-receive hook
20         remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
21         remote: # proc-receive hook
22         remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
23         remote: proc-receive> ok refs/for/main/topic
24         remote: proc-receive> option fall-through
25         remote: # post-receive hook
26         remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
27         To <URL/of/upstream.git>
28         *    <COMMIT-B>:refs/for/main/topic    [new reference]
29         Done
30         EOF
31         test_cmp expect actual &&
32         git -C "$upstream" show-ref >out &&
33         make_user_friendly_and_stable_output <out >actual &&
34         cat >expect <<-EOF &&
35         <COMMIT-B> refs/for/main/topic
36         <COMMIT-A> refs/heads/main
37         EOF
38         test_cmp expect actual
39 '
40
41 # Refs of upstream : main(A)             refs/for/main/topic(A)
42 # Refs of workbench: main(A)  tags/v123
43 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
44         git -C "$upstream" update-ref -d refs/for/main/topic
45 '