Merge branch 'jk/index-pack-hotfixes'
[git] / t / t5411 / test-0034-report-ft.sh
1 test_expect_success "setup proc-receive hook (ft, $PROTOCOL)" '
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/master/topic" \
6                 -r "option fall-through"
7         EOF
8 '
9
10 # Refs of upstream : master(A)
11 # Refs of workbench: master(A)  tags/v123
12 # git push         :                       refs/for/master/topic(B)
13 test_expect_success "proc-receive: fall throught, let receive-pack to execute ($PROTOCOL)" '
14         git -C workbench push origin \
15                 $B:refs/for/master/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/master/topic
21         remote: # proc-receive hook
22         remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/master/topic
23         remote: proc-receive> ok refs/for/master/topic
24         remote: proc-receive> option fall-through
25         remote: # post-receive hook
26         remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/master/topic
27         To <URL/of/upstream.git>
28          * [new reference] <COMMIT-B> -> refs/for/master/topic
29         EOF
30         test_cmp expect actual &&
31         git -C "$upstream" show-ref >out &&
32         make_user_friendly_and_stable_output <out >actual &&
33         cat >expect <<-EOF &&
34         <COMMIT-B> refs/for/master/topic
35         <COMMIT-A> refs/heads/master
36         EOF
37         test_cmp expect actual
38 '
39
40 # Refs of upstream : master(A)             refs/for/master/topic(A)
41 # Refs of workbench: master(A)  tags/v123
42 test_expect_success "cleanup ($PROTOCOL)" '
43         git -C "$upstream" update-ref -d refs/for/master/topic
44 '