]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5411/test-0023-report-unexpect-ref--porcelain.sh
Merge branch 'jk/committer-date-is-author-date-fix'
[thirdparty/git.git] / t / t5411 / test-0023-report-unexpect-ref--porcelain.sh
1 test_expect_success "setup proc-receive hook (unexpected ref, $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/heads/master"
6 EOF
7 '
8
9 # Refs of upstream : master(A)
10 # Refs of workbench: master(A) tags/v123
11 # git push : (B) refs/for/master/topic
12 test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)" '
13 test_must_fail git -C workbench push --porcelain origin \
14 $B:refs/heads/master \
15 HEAD: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< <COMMIT-A> <COMMIT-B> refs/heads/master
21 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
22 remote: # proc-receive hook
23 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
24 remote: proc-receive> ok refs/heads/master
25 remote: error: proc-receive reported status on unexpected ref: refs/heads/master
26 remote: # post-receive hook
27 remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/master
28 To <URL/of/upstream.git>
29 <COMMIT-B>:refs/heads/master <OID-A>..<OID-B>
30 ! HEAD:refs/for/master/topic [remote rejected] (proc-receive failed to report status)
31 Done
32 EOF
33 test_cmp expect actual &&
34 git -C "$upstream" show-ref >out &&
35 make_user_friendly_and_stable_output <out >actual &&
36 cat >expect <<-EOF &&
37 <COMMIT-B> refs/heads/master
38 EOF
39 test_cmp expect actual
40 '
41
42 # Refs of upstream : master(B)
43 # Refs of workbench: master(A) tags/v123
44 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
45 git -C "$upstream" update-ref refs/heads/master $A
46 '