1 test_expect_success "setup pre-receive hook ($PROTOCOL)" '
2 mv "$upstream/hooks/pre-receive" "$upstream/hooks/pre-receive.ok" &&
3 write_script "$upstream/hooks/pre-receive" <<-EOF
8 # Refs of upstream : master(A)
9 # Refs of workbench: master(A) tags/v123
10 # git-push : master(B) next(A)
11 test_expect_success "git-push is declined ($PROTOCOL)" '
12 test_must_fail git -C workbench push origin \
13 $B:refs/heads/master \
14 HEAD:refs/heads/next \
16 make_user_friendly_and_stable_output <out >actual &&
18 To <URL/of/upstream.git>
19 ! [remote rejected] <COMMIT-B> -> master (pre-receive hook declined)
20 ! [remote rejected] HEAD -> next (pre-receive hook declined)
22 test_cmp expect actual &&
23 git -C "$upstream" show-ref >out &&
24 make_user_friendly_and_stable_output <out >actual &&
26 <COMMIT-A> refs/heads/master
28 test_cmp expect actual
31 test_expect_success "cleanup ($PROTOCOL)" '
32 mv "$upstream/hooks/pre-receive.ok" "$upstream/hooks/pre-receive"