Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 1 | test_expect_success "setup proc-receive hook (ft, $PROTOCOL)" ' |
Ævar Arnfjörð Bjarmason | c39176b | 2022-03-17 11:13:17 +0100 | [diff] [blame] | 2 | test_hook -C "$upstream" --clobber proc-receive <<-\EOF |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 3 | printf >&2 "# proc-receive hook\n" |
| 4 | test-tool proc-receive -v \ |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 5 | -r "ok refs/for/main/topic" \ |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 6 | -r "option fall-through" |
| 7 | EOF |
| 8 | ' |
| 9 | |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 10 | # Refs of upstream : main(A) |
| 11 | # Refs of workbench: main(A) tags/v123 |
| 12 | # git push : refs/for/main/topic(B) |
Andrew Kreimer | f56f9d6 | 2024-10-24 14:47:20 +0300 | [diff] [blame] | 13 | test_expect_success "proc-receive: fall through, let receive-pack to execute ($PROTOCOL)" ' |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 14 | git -C workbench push origin \ |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 15 | $B:refs/for/main/topic \ |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 16 | >out 2>&1 && |
| 17 | make_user_friendly_and_stable_output <out >actual && |
Jiang Xin | 2bafb3d | 2021-06-17 11:17:25 +0800 | [diff] [blame] | 18 | format_and_save_expect <<-EOF && |
| 19 | > remote: # pre-receive hook Z |
| 20 | > remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic Z |
| 21 | > remote: # proc-receive hook Z |
| 22 | > remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic Z |
| 23 | > remote: proc-receive> ok refs/for/main/topic Z |
| 24 | > remote: proc-receive> option fall-through Z |
| 25 | > remote: # post-receive hook Z |
| 26 | > remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic Z |
| 27 | > To <URL/of/upstream.git> |
| 28 | > * [new reference] <COMMIT-B> -> refs/for/main/topic |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 29 | EOF |
| 30 | test_cmp expect actual && |
Jiang Xin | 822ee89 | 2021-01-20 21:53:31 -0500 | [diff] [blame] | 31 | |
| 32 | test_cmp_refs -C "$upstream" <<-EOF |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 33 | <COMMIT-B> refs/for/main/topic |
| 34 | <COMMIT-A> refs/heads/main |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 35 | EOF |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 36 | ' |
| 37 | |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 38 | # Refs of upstream : main(A) refs/for/main/topic(A) |
| 39 | # Refs of workbench: main(A) tags/v123 |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 40 | test_expect_success "cleanup ($PROTOCOL)" ' |
Johannes Schindelin | 8f0a264 | 2020-10-31 19:46:01 +0000 | [diff] [blame] | 41 | git -C "$upstream" update-ref -d refs/for/main/topic |
Jiang Xin | 15d3af5 | 2020-08-27 11:45:44 -0400 | [diff] [blame] | 42 | ' |