Merge tag 'l10n-2.31.0-rnd2' of git://github.com/git-l10n/git-po
[git/debian.git] / t / t5411 / test-0020-report-ng.sh
blobad2c8f65355d94765c40ea7491f2fa3200a526bb
1 test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL)" '
2 write_script "$upstream/hooks/proc-receive" <<-EOF
3 printf >&2 "# proc-receive hook\n"
4 test-tool proc-receive -v \
5 -r "ng refs/for/main/topic"
6 EOF
9 # Refs of upstream : main(A)
10 # Refs of workbench: main(A) tags/v123
11 # git push : refs/for/main/topic
12 test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
13 test_must_fail git -C workbench push origin \
14 HEAD:refs/for/main/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 cat >expect <<-EOF &&
18 remote: # pre-receive hook
19 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 remote: # proc-receive hook
21 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 remote: proc-receive> ng refs/for/main/topic
23 To <URL/of/upstream.git>
24 ! [remote rejected] HEAD -> refs/for/main/topic (failed)
25 EOF
26 test_cmp expect actual &&
28 test_cmp_refs -C "$upstream" <<-EOF
29 <COMMIT-A> refs/heads/main
30 EOF
33 test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" '
34 write_script "$upstream/hooks/proc-receive" <<-EOF
35 printf >&2 "# proc-receive hook\n"
36 test-tool proc-receive -v \
37 -r "ng refs/for/main/topic error msg"
38 EOF
41 # Refs of upstream : main(A)
42 # Refs of workbench: main(A) tags/v123
43 # git push : refs/for/main/topic
44 test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)" '
45 test_must_fail git -C workbench push origin \
46 HEAD:refs/for/main/topic \
47 >out-$test_count 2>&1 &&
48 make_user_friendly_and_stable_output <out-$test_count >actual &&
49 cat >expect <<-EOF &&
50 remote: # pre-receive hook
51 remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
52 remote: # proc-receive hook
53 remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
54 remote: proc-receive> ng refs/for/main/topic error msg
55 To <URL/of/upstream.git>
56 ! [remote rejected] HEAD -> refs/for/main/topic (error msg)
57 EOF
58 test_cmp expect actual &&
60 test_cmp_refs -C "$upstream" <<-EOF
61 <COMMIT-A> refs/heads/main
62 EOF