]>
Commit | Line | Data |
---|---|---|
31e8595a JX |
1 | test_expect_success "setup receive.procReceiveRefs" ' |
2 | git -C "$upstream" config --add receive.procReceiveRefs refs/for | |
3 | ' | |
4 | ||
63518a57 | 5 | test_expect_success "setup proc-receive hook" ' |
c39176b1 | 6 | test_hook -C "$upstream" --clobber proc-receive <<-EOF |
63518a57 JX |
7 | printf >&2 "# proc-receive hook\n" |
8 | test-tool proc-receive -v \ | |
a9568dba | 9 | -r "ok refs/for/main/topic1" \ |
63518a57 | 10 | -r "option fall-through" \ |
a9568dba | 11 | -r "ok refs/for/main/topic2" \ |
63518a57 JX |
12 | -r "option refname refs/for/changes/23/123/1" \ |
13 | -r "option new-oid $A" \ | |
a9568dba | 14 | -r "ok refs/for/main/topic2" \ |
63518a57 JX |
15 | -r "option refname refs/for/changes/24/124/2" \ |
16 | -r "option old-oid $B" \ | |
17 | -r "option new-oid $A" \ | |
18 | -r "option forced-update" \ | |
19 | -r "ng refs/for/next/topic target branch not exist" | |
20 | EOF | |
21 | ' | |
22 | ||
a9568dba JS |
23 | # Refs of upstream : main(A) |
24 | # Refs of workbench: main(A) tags/v123 | |
25 | # git push : (B) refs/for/main/topic1(A) foo(A) refs/for/next/topic(A) refs/for/main/topic2(A) | |
63518a57 JX |
26 | test_expect_success "proc-receive: report status v1" ' |
27 | { | |
28 | if test -z "$GIT_DEFAULT_HASH" || test "$GIT_DEFAULT_HASH" = "sha1" | |
29 | then | |
a9568dba | 30 | printf "%s %s refs/heads/main\0report-status\n" \ |
64f0109f | 31 | $A $B | packetize_raw |
63518a57 | 32 | else |
a9568dba | 33 | printf "%s %s refs/heads/main\0report-status object-format=$GIT_DEFAULT_HASH\n" \ |
64f0109f | 34 | $A $B | packetize_raw |
63518a57 | 35 | fi && |
a9568dba | 36 | printf "%s %s refs/for/main/topic1\n" \ |
63518a57 JX |
37 | $ZERO_OID $A | packetize && |
38 | printf "%s %s refs/heads/foo\n" \ | |
39 | $ZERO_OID $A | packetize && | |
40 | printf "%s %s refs/for/next/topic\n" \ | |
41 | $ZERO_OID $A | packetize && | |
a9568dba | 42 | printf "%s %s refs/for/main/topic2\n" \ |
63518a57 JX |
43 | $ZERO_OID $A | packetize && |
44 | printf 0000 && | |
45 | printf "" | git -C "$upstream" pack-objects --stdout | |
46 | } | git receive-pack "$upstream" --stateless-rpc \ | |
47 | >out 2>&1 && | |
48 | make_user_friendly_and_stable_output <out >actual && | |
49 | cat >expect <<-EOF && | |
50 | # pre-receive hook | |
a9568dba JS |
51 | pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main |
52 | pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic1 | |
63518a57 JX |
53 | pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo |
54 | pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic | |
a9568dba | 55 | pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic2 |
63518a57 | 56 | # proc-receive hook |
a9568dba | 57 | proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic1 |
63518a57 | 58 | proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic |
a9568dba JS |
59 | proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic2 |
60 | proc-receive> ok refs/for/main/topic1 | |
63518a57 | 61 | proc-receive> option fall-through |
a9568dba | 62 | proc-receive> ok refs/for/main/topic2 |
63518a57 JX |
63 | proc-receive> option refname refs/for/changes/23/123/1 |
64 | proc-receive> option new-oid <COMMIT-A> | |
a9568dba | 65 | proc-receive> ok refs/for/main/topic2 |
63518a57 JX |
66 | proc-receive> option refname refs/for/changes/24/124/2 |
67 | proc-receive> option old-oid <COMMIT-B> | |
68 | proc-receive> option new-oid <COMMIT-A> | |
69 | proc-receive> option forced-update | |
70 | proc-receive> ng refs/for/next/topic target branch not exist | |
71 | 000eunpack ok | |
5d5f4ea3 JS |
72 | 0017ok refs/heads/main |
73 | 001cok refs/for/main/topic1 | |
63518a57 JX |
74 | 0016ok refs/heads/foo |
75 | 0033ng refs/for/next/topic target branch not exist | |
5d5f4ea3 | 76 | 001cok refs/for/main/topic2 |
63518a57 | 77 | 0000# post-receive hook |
a9568dba JS |
78 | post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main |
79 | post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic1 | |
63518a57 JX |
80 | post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo |
81 | post-receive< <ZERO-OID> <COMMIT-A> refs/for/changes/23/123/1 | |
82 | post-receive< <COMMIT-B> <COMMIT-A> refs/for/changes/24/124/2 | |
83 | EOF | |
84 | test_cmp expect actual && | |
85 | ||
822ee894 | 86 | test_cmp_refs -C "$upstream" <<-EOF |
a9568dba | 87 | <COMMIT-A> refs/for/main/topic1 |
63518a57 | 88 | <COMMIT-A> refs/heads/foo |
a9568dba | 89 | <COMMIT-B> refs/heads/main |
63518a57 | 90 | EOF |
63518a57 | 91 | ' |