]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5411/test-0025-report-unknown-ref--porcelain.sh
t5411: adjust the remaining support files for init.defaultBranch=main
[thirdparty/git.git] / t / t5411 / test-0025-report-unknown-ref--porcelain.sh
CommitLineData
15d3af5e
JX
1test_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 \
a9568dba 5 -r "ok refs/for/main/topic"
15d3af5e
JX
6 EOF
7'
8
a9568dba
JS
9# Refs of upstream : main(A)
10# Refs of workbench: main(A) tags/v123
15d3af5e
JX
11# git push : refs/for/a/b/c/my/topic
12test_expect_success "proc-receive: report unknown reference ($PROTOCOL/porcelain)" '
13 test_must_fail git -C workbench push --porcelain origin \
14 HEAD:refs/for/a/b/c/my/topic \
15 >out 2>&1 &&
16 make_user_friendly_and_stable_output <out >actual &&
17 cat >expect <<-EOF &&
18 remote: # pre-receive hook
19 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
20 remote: # proc-receive hook
21 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
a9568dba
JS
22 remote: proc-receive> ok refs/for/main/topic
23 remote: error: proc-receive reported status on unknown ref: refs/for/main/topic
15d3af5e
JX
24 To <URL/of/upstream.git>
25 ! HEAD:refs/for/a/b/c/my/topic [remote rejected] (proc-receive failed to report status)
26 Done
27 EOF
28 test_cmp expect actual &&
29 git -C "$upstream" show-ref >out &&
30 make_user_friendly_and_stable_output <out >actual &&
31 cat >expect <<-EOF &&
a9568dba 32 <COMMIT-A> refs/heads/main
15d3af5e
JX
33 EOF
34 test_cmp expect actual
35'