Merge tag 'l10n-2.31.0-rnd2' of git://github.com/git-l10n/git-po
[git/debian.git] / t / t5411 / test-0023-report-unexpect-ref--porcelain.sh
blobe89096fa13b65c5df4bbe3358c75ccaf9303adf0
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/main"
6 EOF
9 # Refs of upstream : main(A)
10 # Refs of workbench: main(A) tags/v123
11 # git push : (B) refs/for/main/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/main \
15 HEAD:refs/for/main/topic \
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
18 cat >expect <<-EOF &&
19 remote: # pre-receive hook
20 remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
21 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 remote: # proc-receive hook
23 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
24 remote: proc-receive> ok refs/heads/main
25 remote: error: proc-receive reported status on unexpected ref: refs/heads/main
26 remote: # post-receive hook
27 remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
28 To <URL/of/upstream.git>
29 <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
30 ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
31 Done
32 EOF
33 test_cmp expect actual &&
35 test_cmp_refs -C "$upstream" <<-EOF
36 <COMMIT-B> refs/heads/main
37 EOF
40 # Refs of upstream : main(B)
41 # Refs of workbench: main(A) tags/v123
42 test_expect_success "cleanup ($PROTOCOL/porcelain)" '
43 git -C "$upstream" update-ref refs/heads/main $A