]>
Commit | Line | Data |
---|---|---|
38b9197a JX |
1 | test_expect_success "setup pre-receive hook ($PROTOCOL/porcelain)" ' |
2 | mv "$upstream/hooks/pre-receive" "$upstream/hooks/pre-receive.ok" && | |
c39176b1 | 3 | test_hook -C "$upstream" --clobber pre-receive <<-\EOF |
38b9197a JX |
4 | exit 1 |
5 | EOF | |
6 | ' | |
7 | ||
a9568dba JS |
8 | # Refs of upstream : main(A) |
9 | # Refs of workbench: main(A) tags/v123 | |
10 | # git-push : main(B) next(A) | |
38b9197a JX |
11 | test_expect_success "git-push is declined ($PROTOCOL/porcelain)" ' |
12 | test_must_fail git -C workbench push --porcelain origin \ | |
a9568dba | 13 | $B:refs/heads/main \ |
38b9197a | 14 | HEAD:refs/heads/next \ |
8388a64c JX |
15 | >out-$test_count 2>&1 && |
16 | make_user_friendly_and_stable_output <out-$test_count >actual && | |
2bafb3d7 JX |
17 | format_and_save_expect <<-EOF && |
18 | > To <URL/of/upstream.git> | |
19 | > ! <COMMIT-B>:refs/heads/main [remote rejected] (pre-receive hook declined) | |
20 | > ! HEAD:refs/heads/next [remote rejected] (pre-receive hook declined) | |
38b9197a JX |
21 | Done |
22 | EOF | |
23 | test_cmp expect actual && | |
822ee894 JX |
24 | |
25 | test_cmp_refs -C "$upstream" <<-EOF | |
a9568dba | 26 | <COMMIT-A> refs/heads/main |
38b9197a | 27 | EOF |
38b9197a JX |
28 | ' |
29 | ||
30 | test_expect_success "cleanup ($PROTOCOL/porcelain)" ' | |
31 | mv "$upstream/hooks/pre-receive.ok" "$upstream/hooks/pre-receive" | |
32 | ' |