interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t5411 / test-0002-pre-receive-declined.sh

31 lines · 965 bytes Raw Blame History
1test_expect_success "setup pre-receive hook ($PROTOCOL)" '
2 mv "$upstream/hooks/pre-receive" "$upstream/hooks/pre-receive.ok" &&
3 test_hook -C "$upstream" --clobber pre-receive <<-\EOF
4 exit 1
5 EOF
6'
7
8# Refs of upstream : main(A)
9# Refs of workbench: main(A) tags/v123
10# git-push : main(B) next(A)
11test_expect_success "git-push is declined ($PROTOCOL)" '
12 test_must_fail git -C workbench push origin \
13 $B:refs/heads/main \
14 HEAD:refs/heads/next \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 cat >expect <<-EOF &&
18 To <URL/of/upstream.git>
19 ! [remote rejected] <COMMIT-B> -> main (pre-receive hook declined)
20 ! [remote rejected] HEAD -> next (pre-receive hook declined)
21 EOF
22 test_cmp expect actual &&
23
24 test_cmp_refs -C "$upstream" <<-\EOF
25 <COMMIT-A> refs/heads/main
26 EOF
27'
28
29test_expect_success "cleanup ($PROTOCOL)" '
30 mv "$upstream/hooks/pre-receive.ok" "$upstream/hooks/pre-receive"
31'