]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5411/test-0023-report-unexpect-ref--porcelain.sh
Merge branch 'jh/sparse-index-expand-to-path-fix'
[thirdparty/git.git] / t / t5411 / test-0023-report-unexpect-ref--porcelain.sh
CommitLineData
15d3af5e 1test_expect_success "setup proc-receive hook (unexpected ref, $PROTOCOL/porcelain)" '
c39176b1 2 test_hook -C "$upstream" --clobber proc-receive <<-\EOF
15d3af5e
JX
3 printf >&2 "# proc-receive hook\n"
4 test-tool proc-receive -v \
a9568dba 5 -r "ok refs/heads/main"
15d3af5e
JX
6 EOF
7'
8
a9568dba
JS
9# Refs of upstream : main(A)
10# Refs of workbench: main(A) tags/v123
11# git push : (B) refs/for/main/topic
15d3af5e
JX
12test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)" '
13 test_must_fail git -C workbench push --porcelain origin \
a9568dba
JS
14 $B:refs/heads/main \
15 HEAD:refs/for/main/topic \
8388a64c
JX
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
2bafb3d7
JX
18 format_and_save_expect <<-EOF &&
19 > remote: # pre-receive hook Z
20 > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
21 > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 > remote: # proc-receive hook Z
23 > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
24 > remote: proc-receive> ok refs/heads/main Z
25 > remote: error: proc-receive reported status on unexpected ref: refs/heads/main Z
26 > remote: # post-receive hook Z
27 > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
28 > To <URL/of/upstream.git>
12d6991c 29 > <COMMIT-B>:refs/heads/main <COMMIT-A>..<COMMIT-B>
2bafb3d7
JX
30 > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
31 > Done
15d3af5e
JX
32 EOF
33 test_cmp expect actual &&
822ee894
JX
34
35 test_cmp_refs -C "$upstream" <<-EOF
a9568dba 36 <COMMIT-B> refs/heads/main
15d3af5e 37 EOF
15d3af5e
JX
38'
39
a9568dba
JS
40# Refs of upstream : main(B)
41# Refs of workbench: main(A) tags/v123
15d3af5e 42test_expect_success "cleanup ($PROTOCOL/porcelain)" '
a9568dba 43 git -C "$upstream" update-ref refs/heads/main $A
15d3af5e 44'