test: compare raw output, not mangle tabs and spaces

Before comparing with the expect file, we used to call function "make_user_friendly_and_stable_output" to filter out trailing spaces in output. Ævar recommends using pattern "s/Z$//" to prepare expect file, and then compare it with raw output. Since we have fixed the issue of occasionally missing the clear-to-eol suffix when displaying sideband #2 messages, it is safe and stable to test against raw output. Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jiang Xin committed Jun 17, 2021 at 11:17 UTC 2bafb3d702d4cd77de0d3e68f13188980e0de734
31 files changed +972 -966
t/t5411/common-functions.sh
+5 -4
@@ -33,17 +33,14 @@ create_commits_in () {
33
34 # Format the output of git-push, git-show-ref and other commands to make a
35 # user-friendly and stable text. We can easily prepare the expect text
36 -# without having to worry about future changes of the commit ID and spaces
36 +# without having to worry about changes of the commit ID (full or abbrev.)
37 # of the output. Single quotes are replaced with double quotes, because
38 # it is boring to prepare unquoted single quotes in expect text. We also
39 # remove some locale error messages. The emitted human-readable errors are
40 # redundant to the more machine-readable output the tests already assert.
41 make_user_friendly_and_stable_output () {
42 sed \
43 - -e "s/ *\$//" \
44 - -e "s/ */ /g" \
43 -e "s/'/\"/g" \
46 - -e "s/ / /g" \
44 -e "s/$A/<COMMIT-A>/g" \
45 -e "s/$B/<COMMIT-B>/g" \
46 -e "s/$TAG/<TAG-v123>/g" \
@@ -59,6 +56,10 @@ filter_out_user_friendly_and_stable_output () {
56 sed -n ${1+"$@"}
57 }
58
59 +format_and_save_expect () {
60 + sed -e 's/^> //' -e 's/Z$//' >expect
61 +}
62 +
63 test_cmp_refs () {
64 indir=
65 if test "$1" = "-C"
t/t5411/test-0000-standard-git-push.sh
+41 -41
@@ -7,16 +7,16 @@ test_expect_success "git-push ($PROTOCOL)" '
7 HEAD:refs/heads/next \
8 >out 2>&1 &&
9 make_user_friendly_and_stable_output <out >actual &&
10 - cat >expect <<-EOF &&
11 - remote: # pre-receive hook
12 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
13 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
14 - remote: # post-receive hook
15 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
16 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 - To <URL/of/upstream.git>
18 - <OID-A>..<OID-B> <COMMIT-B> -> main
19 - * [new branch] HEAD -> next
10 + format_and_save_expect <<-EOF &&
11 + > remote: # pre-receive hook Z
12 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
13 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
14 + > remote: # post-receive hook Z
15 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
16 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
17 + > To <URL/of/upstream.git>
18 + > <OID-A>..<OID-B> <COMMIT-B> -> main
19 + > * [new branch] HEAD -> next
20 EOF
21 test_cmp expect actual &&
22
@@ -38,10 +38,10 @@ test_expect_success "git-push --atomic ($PROTOCOL)" '
38 -e "/^To / { p; }" \
39 -e "/^ ! / { p; }" \
40 <out-$test_count >actual &&
41 - cat >expect <<-EOF &&
42 - To <URL/of/upstream.git>
43 - ! [rejected] main -> main (non-fast-forward)
44 - ! [rejected] <COMMIT-B> -> next (atomic push failed)
41 + format_and_save_expect <<-EOF &&
42 + > To <URL/of/upstream.git>
43 + > ! [rejected] main -> main (non-fast-forward)
44 + > ! [rejected] <COMMIT-B> -> next (atomic push failed)
45 EOF
46 test_cmp expect actual &&
47
@@ -63,14 +63,14 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL)" '
63 $B:refs/heads/next \
64 >out-$test_count 2>&1 &&
65 make_user_friendly_and_stable_output <out-$test_count >actual &&
66 - cat >expect <<-EOF &&
67 - remote: # pre-receive hook
68 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
69 - remote: # post-receive hook
70 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
71 - To <URL/of/upstream.git>
72 - <OID-A>..<OID-B> <COMMIT-B> -> next
73 - ! [rejected] main -> main (non-fast-forward)
66 + format_and_save_expect <<-EOF &&
67 + > remote: # pre-receive hook Z
68 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next Z
69 + > remote: # post-receive hook Z
70 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next Z
71 + > To <URL/of/upstream.git>
72 + > <OID-A>..<OID-B> <COMMIT-B> -> next
73 + > ! [rejected] main -> main (non-fast-forward)
74 EOF
75 test_cmp expect actual &&
76
@@ -92,25 +92,25 @@ test_expect_success "git-push -f ($PROTOCOL)" '
92 HEAD:refs/heads/a/b/c \
93 >out 2>&1 &&
94 make_user_friendly_and_stable_output <out >actual &&
95 - cat >expect <<-EOF &&
96 - remote: # pre-receive hook
97 - remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
98 - remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next
99 - remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
100 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic
101 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c
102 - remote: # post-receive hook
103 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
104 - remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next
105 - remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
106 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic
107 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c
108 - To <URL/of/upstream.git>
109 - + <OID-B>...<OID-A> main -> main (forced update)
110 - - [deleted] next
111 - * [new tag] v123 -> v123
112 - * [new reference] main -> refs/review/main/topic
113 - * [new branch] HEAD -> a/b/c
95 + format_and_save_expect <<-EOF &&
96 + > remote: # pre-receive hook Z
97 + > remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
98 + > remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next Z
99 + > remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
100 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic Z
101 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c Z
102 + > remote: # post-receive hook Z
103 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
104 + > remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next Z
105 + > remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
106 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic Z
107 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c Z
108 + > To <URL/of/upstream.git>
109 + > + <OID-B>...<OID-A> main -> main (forced update)
110 + > - [deleted] next
111 + > * [new tag] v123 -> v123
112 + > * [new reference] main -> refs/review/main/topic
113 + > * [new branch] HEAD -> a/b/c
114 EOF
115 test_cmp expect actual &&
116
t/t5411/test-0001-standard-git-push--porcelain.sh
+45 -45
@@ -7,17 +7,17 @@ test_expect_success "git-push ($PROTOCOL/porcelain)" '
7 HEAD:refs/heads/next \
8 >out 2>&1 &&
9 make_user_friendly_and_stable_output <out >actual &&
10 - cat >expect <<-EOF &&
11 - remote: # pre-receive hook
12 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
13 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
14 - remote: # post-receive hook
15 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
16 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 - To <URL/of/upstream.git>
18 - <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
19 - * HEAD:refs/heads/next [new branch]
20 - Done
10 + format_and_save_expect <<-EOF &&
11 + > remote: # pre-receive hook Z
12 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
13 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
14 + > remote: # post-receive hook Z
15 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
16 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
17 + > To <URL/of/upstream.git>
18 + > <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
19 + > * HEAD:refs/heads/next [new branch]
20 + > Done
21 EOF
22 test_cmp expect actual &&
23
@@ -38,12 +38,12 @@ test_expect_success "git-push --atomic ($PROTOCOL/porcelain)" '
38 filter_out_user_friendly_and_stable_output \
39 -e "s/^# GETTEXT POISON #//" \
40 -e "/^To / { p; }" \
41 - -e "/^! / { p; }" \
41 + -e "/^!/ { p; }" \
42 <out-$test_count >actual &&
43 - cat >expect <<-EOF &&
44 - To <URL/of/upstream.git>
45 - ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
46 - ! <COMMIT-B>:refs/heads/next [rejected] (atomic push failed)
43 + format_and_save_expect <<-EOF &&
44 + > To <URL/of/upstream.git>
45 + > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
46 + > ! <COMMIT-B>:refs/heads/next [rejected] (atomic push failed)
47 EOF
48 test_cmp expect actual &&
49
@@ -65,15 +65,15 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
65 $B:refs/heads/next \
66 >out-$test_count 2>&1 &&
67 make_user_friendly_and_stable_output <out-$test_count >actual &&
68 - cat >expect <<-EOF &&
69 - remote: # pre-receive hook
70 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
71 - remote: # post-receive hook
72 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
73 - To <URL/of/upstream.git>
74 - <COMMIT-B>:refs/heads/next <OID-A>..<OID-B>
75 - ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
76 - Done
68 + format_and_save_expect <<-EOF &&
69 + > remote: # pre-receive hook Z
70 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next Z
71 + > remote: # post-receive hook Z
72 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next Z
73 + > To <URL/of/upstream.git>
74 + > <COMMIT-B>:refs/heads/next <OID-A>..<OID-B>
75 + > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
76 + > Done
77 EOF
78 test_cmp expect actual &&
79
@@ -95,26 +95,26 @@ test_expect_success "git-push -f ($PROTOCOL/porcelain)" '
95 HEAD:refs/heads/a/b/c \
96 >out 2>&1 &&
97 make_user_friendly_and_stable_output <out >actual &&
98 - cat >expect <<-EOF &&
99 - remote: # pre-receive hook
100 - remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
101 - remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next
102 - remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
103 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic
104 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c
105 - remote: # post-receive hook
106 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
107 - remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next
108 - remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
109 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic
110 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c
111 - To <URL/of/upstream.git>
112 - + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
113 - - :refs/heads/next [deleted]
114 - * refs/tags/v123:refs/tags/v123 [new tag]
115 - * refs/heads/main:refs/review/main/topic [new reference]
116 - * HEAD:refs/heads/a/b/c [new branch]
117 - Done
98 + format_and_save_expect <<-EOF &&
99 + > remote: # pre-receive hook Z
100 + > remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
101 + > remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next Z
102 + > remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
103 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic Z
104 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c Z
105 + > remote: # post-receive hook Z
106 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
107 + > remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next Z
108 + > remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
109 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic Z
110 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c Z
111 + > To <URL/of/upstream.git>
112 + > + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
113 + > - :refs/heads/next [deleted]
114 + > * refs/tags/v123:refs/tags/v123 [new tag]
115 + > * refs/heads/main:refs/review/main/topic [new reference]
116 + > * HEAD:refs/heads/a/b/c [new branch]
117 + > Done
118 EOF
119 test_cmp expect actual &&
120
t/t5411/test-0003-pre-receive-declined--porcelain.sh
+4 -4
@@ -14,10 +14,10 @@ test_expect_success "git-push is declined ($PROTOCOL/porcelain)" '
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 - ! <COMMIT-B>:refs/heads/main [remote rejected] (pre-receive hook declined)
20 - ! HEAD:refs/heads/next [remote rejected] (pre-receive hook declined)
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)
21 Done
22 EOF
23 test_cmp expect actual &&
t/t5411/test-0011-no-hook-error.sh
+20 -20
@@ -7,16 +7,16 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL)
7 HEAD:refs/for/main/topic \
8 >out-$test_count 2>&1 &&
9 make_user_friendly_and_stable_output <out-$test_count >actual &&
10 - cat >expect <<-EOF &&
11 - remote: # pre-receive hook
12 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
13 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
14 - remote: error: cannot find hook "proc-receive"
15 - remote: # post-receive hook
16 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 - To <URL/of/upstream.git>
18 - * [new branch] HEAD -> next
19 - ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
10 + format_and_save_expect <<-EOF &&
11 + > remote: # pre-receive hook Z
12 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
13 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
14 + > remote: error: cannot find hook "proc-receive" Z
15 + > remote: # post-receive hook Z
16 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
17 + > To <URL/of/upstream.git>
18 + > * [new branch] HEAD -> next
19 + > ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
20 EOF
21 test_cmp expect actual &&
22
@@ -41,16 +41,16 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
41 HEAD:next \
42 HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
43 make_user_friendly_and_stable_output <out-$test_count >actual &&
44 - cat >expect <<-EOF &&
45 - remote: # pre-receive hook
46 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
47 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
48 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
49 - remote: error: cannot find hook "proc-receive"
50 - To <URL/of/upstream.git>
51 - ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)
52 - ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
53 - ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
44 + format_and_save_expect <<-EOF &&
45 + > remote: # pre-receive hook Z
46 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
47 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
48 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
49 + > remote: error: cannot find hook "proc-receive" Z
50 + > To <URL/of/upstream.git>
51 + > ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)
52 + > ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
53 + > ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
54 EOF
55 test_cmp expect actual &&
56
t/t5411/test-0012-no-hook-error--porcelain.sh
+21 -21
@@ -7,16 +7,16 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/
7 HEAD:refs/for/main/topic \
8 >out-$test_count 2>&1 &&
9 make_user_friendly_and_stable_output <out-$test_count >actual &&
10 - cat >expect <<-EOF &&
11 - remote: # pre-receive hook
12 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
13 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
14 - remote: error: cannot find hook "proc-receive"
15 - remote: # post-receive hook
16 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
17 - To <URL/of/upstream.git>
18 - * HEAD:refs/heads/next [new branch]
19 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
10 + format_and_save_expect <<-EOF &&
11 + > remote: # pre-receive hook Z
12 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
13 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
14 + > remote: error: cannot find hook "proc-receive" Z
15 + > remote: # post-receive hook Z
16 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
17 + > To <URL/of/upstream.git>
18 + > * HEAD:refs/heads/next [new branch]
19 + > ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
20 Done
21 EOF
22 test_cmp expect actual &&
@@ -42,17 +42,17 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
42 HEAD:next \
43 HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
44 make_user_friendly_and_stable_output <out-$test_count >actual &&
45 - cat >expect <<-EOF &&
46 - remote: # pre-receive hook
47 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
48 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
49 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
50 - remote: error: cannot find hook "proc-receive"
51 - To <URL/of/upstream.git>
52 - ! <COMMIT-B>:refs/heads/main [remote rejected] (fail to run proc-receive hook)
53 - ! HEAD:refs/heads/next [remote rejected] (fail to run proc-receive hook)
54 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
55 - Done
45 + format_and_save_expect <<-EOF &&
46 + > remote: # pre-receive hook Z
47 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
48 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
49 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
50 + > remote: error: cannot find hook "proc-receive" Z
51 + > To <URL/of/upstream.git>
52 + > ! <COMMIT-B>:refs/heads/main [remote rejected] (fail to run proc-receive hook)
53 + > ! HEAD:refs/heads/next [remote rejected] (fail to run proc-receive hook)
54 + > ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
55 + > Done
56 EOF
57 test_cmp expect actual &&
58
t/t5411/test-0013-bad-protocol.sh
+31 -31
@@ -29,8 +29,8 @@ test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL)" '
29 # message ("remote: fatal: the remote end hung up unexpectedly") which
30 # is different from the remote HTTP server with different locale settings.
31 grep "^remote: error:" <actual >actual-error &&
32 - cat >expect <<-EOF &&
33 - remote: error: proc-receive version "2" is not supported
32 + format_and_save_expect <<-EOF &&
33 + > remote: error: proc-receive version "2" is not supported Z
34 EOF
35 test_cmp expect actual-error &&
36
@@ -208,17 +208,17 @@ test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL)" '
208 HEAD:refs/heads/next \
209 HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
210 make_user_friendly_and_stable_output <out-$test_count >actual &&
211 - cat >expect <<-EOF &&
212 - remote: # pre-receive hook
213 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
214 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
215 - remote: # proc-receive hook
216 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
217 - remote: # post-receive hook
218 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
219 - To <URL/of/upstream.git>
220 - * [new branch] HEAD -> next
221 - ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
211 + format_and_save_expect <<-EOF &&
212 + > remote: # pre-receive hook Z
213 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
214 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
215 + > remote: # proc-receive hook Z
216 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
217 + > remote: # post-receive hook Z
218 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
219 + > To <URL/of/upstream.git>
220 + > * [new branch] HEAD -> next
221 + > ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
222 EOF
223 test_cmp expect actual &&
224
@@ -251,15 +251,15 @@ test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL)" '
251 HEAD:refs/for/main/topic\
252 >out-$test_count 2>&1 &&
253 make_user_friendly_and_stable_output <out-$test_count >actual &&
254 - cat >expect <<-EOF &&
255 - remote: # pre-receive hook
256 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
257 - remote: # proc-receive hook
258 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
259 - remote: proc-receive> ok
260 - remote: error: proc-receive reported incomplete status line: "ok"
261 - To <URL/of/upstream.git>
262 - ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
254 + format_and_save_expect <<-EOF &&
255 + > remote: # pre-receive hook Z
256 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
257 + > remote: # proc-receive hook Z
258 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
259 + > remote: proc-receive> ok Z
260 + > remote: error: proc-receive reported incomplete status line: "ok" Z
261 + > To <URL/of/upstream.git>
262 + > ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
263 EOF
264 test_cmp expect actual &&
265
@@ -284,15 +284,15 @@ test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL)" '
284 HEAD:refs/for/main/topic \
285 >out-$test_count 2>&1 &&
286 make_user_friendly_and_stable_output <out-$test_count >actual &&
287 - cat >expect <<-EOF &&
288 - remote: # pre-receive hook
289 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
290 - remote: # proc-receive hook
291 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
292 - remote: proc-receive> xx refs/for/main/topic
293 - remote: error: proc-receive reported bad status "xx" on ref "refs/for/main/topic"
294 - To <URL/of/upstream.git>
295 - ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
287 + format_and_save_expect <<-EOF &&
288 + > remote: # pre-receive hook Z
289 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
290 + > remote: # proc-receive hook Z
291 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
292 + > remote: proc-receive> xx refs/for/main/topic Z
293 + > remote: error: proc-receive reported bad status "xx" on ref "refs/for/main/topic" Z
294 + > To <URL/of/upstream.git>
295 + > ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
296 EOF
297 test_cmp expect actual &&
298
t/t5411/test-0014-bad-protocol--porcelain.sh
+40 -40
@@ -20,7 +20,7 @@ test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL/porc
20 <actual >actual-report &&
21 cat >expect <<-EOF &&
22 To <URL/of/upstream.git>
23 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
23 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
24 Done
25 EOF
26 test_cmp expect actual-report &&
@@ -29,8 +29,8 @@ test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL/porc
29 # message ("remote: fatal: the remote end hung up unexpectedly") which
30 # is different from the remote HTTP server with different locale settings.
31 grep "^remote: error:" <actual >actual-error &&
32 - cat >expect <<-EOF &&
33 - remote: error: proc-receive version "2" is not supported
32 + format_and_save_expect <<-EOF &&
33 + > remote: error: proc-receive version "2" is not supported Z
34 EOF
35 test_cmp expect actual-error &&
36
@@ -58,7 +58,7 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-version, $PROTO
58 <out-$test_count >actual &&
59 cat >expect <<-EOF &&
60 To <URL/of/upstream.git>
61 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
61 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
62 Done
63 EOF
64 test_cmp expect actual &&
@@ -89,7 +89,7 @@ test_expect_success "proc-receive: bad protocol (hook --die-write-version, $PROT
89 <out-$test_count >actual &&
90 cat >expect <<-EOF &&
91 To <URL/of/upstream.git>
92 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
92 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
93 Done
94 EOF
95 test_cmp expect actual &&
@@ -120,7 +120,7 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-commands, $PROT
120 <out-$test_count >actual &&
121 cat >expect <<-EOF &&
122 To <URL/of/upstream.git>
123 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
123 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
124 Done
125 EOF
126 test_cmp expect actual &&
@@ -152,7 +152,7 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-push-options, $
152 <out-$test_count >actual &&
153 cat >expect <<-EOF &&
154 To <URL/of/upstream.git>
155 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
155 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
156 Done
157 EOF
158 test_cmp expect actual &&
@@ -182,7 +182,7 @@ test_expect_success "proc-receive: bad protocol (hook --die-write-report, $PROTO
182 <out-$test_count >actual &&
183 cat >expect <<-EOF &&
184 To <URL/of/upstream.git>
185 - ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
185 + ! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
186 Done
187 EOF
188 test_cmp expect actual &&
@@ -208,18 +208,18 @@ test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL/porcelain)
208 HEAD:refs/heads/next \
209 HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
210 make_user_friendly_and_stable_output <out-$test_count >actual &&
211 - cat >expect <<-EOF &&
212 - remote: # pre-receive hook
213 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
214 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
215 - remote: # proc-receive hook
216 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
217 - remote: # post-receive hook
218 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
219 - To <URL/of/upstream.git>
220 - * HEAD:refs/heads/next [new branch]
221 - ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
222 - Done
211 + format_and_save_expect <<-EOF &&
212 + > remote: # pre-receive hook Z
213 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
214 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
215 + > remote: # proc-receive hook Z
216 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
217 + > remote: # post-receive hook Z
218 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
219 + > To <URL/of/upstream.git>
220 + > * HEAD:refs/heads/next [new branch]
221 + > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
222 + > Done
223 EOF
224 test_cmp expect actual &&
225
@@ -251,16 +251,16 @@ test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL/porcelain)" '
251 HEAD:refs/for/main/topic\
252 >out-$test_count 2>&1 &&
253 make_user_friendly_and_stable_output <out-$test_count >actual &&
254 - cat >expect <<-EOF &&
255 - remote: # pre-receive hook
256 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
257 - remote: # proc-receive hook
258 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
259 - remote: proc-receive> ok
260 - remote: error: proc-receive reported incomplete status line: "ok"
261 - To <URL/of/upstream.git>
262 - ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
263 - Done
254 + format_and_save_expect <<-EOF &&
255 + > remote: # pre-receive hook Z
256 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
257 + > remote: # proc-receive hook Z
258 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
259 + > remote: proc-receive> ok Z
260 + > remote: error: proc-receive reported incomplete status line: "ok" Z
261 + > To <URL/of/upstream.git>
262 + > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
263 + > Done
264 EOF
265 test_cmp expect actual &&
266
@@ -285,16 +285,16 @@ test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL/porce
285 HEAD:refs/for/main/topic \
286 >out-$test_count 2>&1 &&
287 make_user_friendly_and_stable_output <out-$test_count >actual &&
288 - cat >expect <<-EOF &&
289 - remote: # pre-receive hook
290 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
291 - remote: # proc-receive hook
292 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
293 - remote: proc-receive> xx refs/for/main/topic
294 - remote: error: proc-receive reported bad status "xx" on ref "refs/for/main/topic"
295 - To <URL/of/upstream.git>
296 - ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
297 - Done
288 + format_and_save_expect <<-EOF &&
289 + > remote: # pre-receive hook Z
290 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
291 + > remote: # proc-receive hook Z
292 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
293 + > remote: proc-receive> xx refs/for/main/topic Z
294 + > remote: error: proc-receive reported bad status "xx" on ref "refs/for/main/topic" Z
295 + > To <URL/of/upstream.git>
296 + > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
297 + > Done
298 EOF
299 test_cmp expect actual &&
300
t/t5411/test-0020-report-ng.sh
+16 -16
@@ -14,14 +14,14 @@ test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
14 HEAD:refs/for/main/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: proc-receive> ng refs/for/main/topic
23 - To <URL/of/upstream.git>
24 - ! [remote rejected] HEAD -> refs/for/main/topic (failed)
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: proc-receive> ng refs/for/main/topic Z
23 + > To <URL/of/upstream.git>
24 + > ! [remote rejected] HEAD -> refs/for/main/topic (failed)
25 EOF
26 test_cmp expect actual &&
27
@@ -46,14 +46,14 @@ test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)"
46 HEAD:refs/for/main/topic \
47 >out-$test_count 2>&1 &&
48 make_user_friendly_and_stable_output <out-$test_count >actual &&
49 - cat >expect <<-EOF &&
50 - remote: # pre-receive hook
51 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
52 - remote: # proc-receive hook
53 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
54 - remote: proc-receive> ng refs/for/main/topic error msg
55 - To <URL/of/upstream.git>
56 - ! [remote rejected] HEAD -> refs/for/main/topic (error msg)
49 + format_and_save_expect <<-EOF &&
50 + > remote: # pre-receive hook Z
51 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
52 + > remote: # proc-receive hook Z
53 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
54 + > remote: proc-receive> ng refs/for/main/topic error msg Z
55 + > To <URL/of/upstream.git>
56 + > ! [remote rejected] HEAD -> refs/for/main/topic (error msg)
57 EOF
58 test_cmp expect actual &&
59
t/t5411/test-0021-report-ng--porcelain.sh
+18 -18
@@ -14,15 +14,15 @@ test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/por
14 HEAD:refs/for/main/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: proc-receive> ng refs/for/main/topic
23 - To <URL/of/upstream.git>
24 - ! HEAD:refs/for/main/topic [remote rejected] (failed)
25 - Done
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: proc-receive> ng refs/for/main/topic Z
23 + > To <URL/of/upstream.git>
24 + > ! HEAD:refs/for/main/topic [remote rejected] (failed)
25 + > Done
26 EOF
27 test_cmp expect actual &&
28
@@ -47,15 +47,15 @@ test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/p
47 HEAD:refs/for/main/topic \
48 >out-$test_count 2>&1 &&
49 make_user_friendly_and_stable_output <out-$test_count >actual &&
50 - cat >expect <<-EOF &&
51 - remote: # pre-receive hook
52 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
53 - remote: # proc-receive hook
54 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
55 - remote: proc-receive> ng refs/for/main/topic error msg
56 - To <URL/of/upstream.git>
57 - ! HEAD:refs/for/main/topic [remote rejected] (error msg)
58 - Done
50 + format_and_save_expect <<-EOF &&
51 + > remote: # pre-receive hook Z
52 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
53 + > remote: # proc-receive hook Z
54 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
55 + > remote: proc-receive> ng refs/for/main/topic error msg Z
56 + > To <URL/of/upstream.git>
57 + > ! HEAD:refs/for/main/topic [remote rejected] (error msg)
58 + > Done
59 EOF
60 test_cmp expect actual &&
61
t/t5411/test-0022-report-unexpect-ref.sh
+13 -13
@@ -15,19 +15,19 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL)" '
15 HEAD:refs/for/main/topic \
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
21 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: # proc-receive hook
23 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
24 - remote: proc-receive> ok refs/heads/main
25 - remote: error: proc-receive reported status on unexpected ref: refs/heads/main
26 - remote: # post-receive hook
27 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
28 - To <URL/of/upstream.git>
29 - <OID-A>..<OID-B> <COMMIT-B> -> main
30 - ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
18 + format_and_save_expect <<-EOF &&
19 + > remote: # pre-receive hook Z
20 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
21 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: # proc-receive hook Z
23 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
24 + > remote: proc-receive> ok refs/heads/main Z
25 + > remote: error: proc-receive reported status on unexpected ref: refs/heads/main Z
26 + > remote: # post-receive hook Z
27 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
28 + > To <URL/of/upstream.git>
29 + > <OID-A>..<OID-B> <COMMIT-B> -> main
30 + > ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
31 EOF
32 test_cmp expect actual &&
33
t/t5411/test-0023-report-unexpect-ref--porcelain.sh
+14 -14
@@ -15,20 +15,20 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)"
15 HEAD:refs/for/main/topic \
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
21 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: # proc-receive hook
23 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
24 - remote: proc-receive> ok refs/heads/main
25 - remote: error: proc-receive reported status on unexpected ref: refs/heads/main
26 - remote: # post-receive hook
27 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
28 - To <URL/of/upstream.git>
29 - <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
30 - ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
31 - Done
18 + format_and_save_expect <<-EOF &&
19 + > remote: # pre-receive hook Z
20 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
21 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: # proc-receive hook Z
23 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
24 + > remote: proc-receive> ok refs/heads/main Z
25 + > remote: error: proc-receive reported status on unexpected ref: refs/heads/main Z
26 + > remote: # post-receive hook Z
27 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
28 + > To <URL/of/upstream.git>
29 + > <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
30 + > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
31 + > Done
32 EOF
33 test_cmp expect actual &&
34
t/t5411/test-0024-report-unknown-ref.sh
+9 -9
@@ -14,15 +14,15 @@ test_expect_success "proc-receive: report unknown reference ($PROTOCOL)" '
14 HEAD:refs/for/a/b/c/my/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
22 - remote: proc-receive> ok refs/for/main/topic
23 - remote: error: proc-receive reported status on unknown ref: refs/for/main/topic
24 - To <URL/of/upstream.git>
25 - ! [remote rejected] HEAD -> refs/for/a/b/c/my/topic (proc-receive failed to report status)
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic Z
22 + > remote: proc-receive> ok refs/for/main/topic Z
23 + > remote: error: proc-receive reported status on unknown ref: refs/for/main/topic Z
24 + > To <URL/of/upstream.git>
25 + > ! [remote rejected] HEAD -> refs/for/a/b/c/my/topic (proc-receive failed to report status)
26 EOF
27 test_cmp expect actual &&
28
t/t5411/test-0025-report-unknown-ref--porcelain.sh
+10 -10
@@ -14,16 +14,16 @@ test_expect_success "proc-receive: report unknown reference ($PROTOCOL/porcelain
14 HEAD:refs/for/a/b/c/my/topic \
15 >out-$test_count 2>&1 &&
16 make_user_friendly_and_stable_output <out-$test_count >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
22 - remote: proc-receive> ok refs/for/main/topic
23 - remote: error: proc-receive reported status on unknown ref: refs/for/main/topic
24 - To <URL/of/upstream.git>
25 - ! HEAD:refs/for/a/b/c/my/topic [remote rejected] (proc-receive failed to report status)
26 - Done
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic Z
22 + > remote: proc-receive> ok refs/for/main/topic Z
23 + > remote: error: proc-receive reported status on unknown ref: refs/for/main/topic Z
24 + > To <URL/of/upstream.git>
25 + > ! HEAD:refs/for/a/b/c/my/topic [remote rejected] (proc-receive failed to report status)
26 + > Done
27 EOF
28 test_cmp expect actual &&
29
t/t5411/test-0026-push-options.sh
+29 -29
@@ -52,19 +52,19 @@ test_expect_success "proc-receive: ignore push-options for version 0 ($PROTOCOL)
52 HEAD:refs/for/main/topic \
53 >out 2>&1 &&
54 make_user_friendly_and_stable_output <out >actual &&
55 - cat >expect <<-EOF &&
56 - remote: # pre-receive hook
57 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
58 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
59 - remote: # proc-receive hook
60 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
61 - remote: proc-receive> ok refs/for/main/topic
62 - remote: # post-receive hook
63 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
64 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
65 - To <URL/of/upstream.git>
66 - * [new branch] HEAD -> next
67 - * [new reference] HEAD -> refs/for/main/topic
55 + format_and_save_expect <<-EOF &&
56 + > remote: # pre-receive hook Z
57 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
58 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
59 + > remote: # proc-receive hook Z
60 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
61 + > remote: proc-receive> ok refs/for/main/topic Z
62 + > remote: # post-receive hook Z
63 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
64 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
65 + > To <URL/of/upstream.git>
66 + > * [new branch] HEAD -> next
67 + > * [new reference] HEAD -> refs/for/main/topic
68 EOF
69 test_cmp expect actual &&
70
@@ -101,22 +101,22 @@ test_expect_success "proc-receive: push with options ($PROTOCOL)" '
101 HEAD:refs/for/main/topic \
102 >out 2>&1 &&
103 make_user_friendly_and_stable_output <out >actual &&
104 - cat >expect <<-EOF &&
105 - remote: # pre-receive hook
106 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
107 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
108 - remote: # proc-receive hook
109 - remote: proc-receive: atomic push_options
110 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
111 - remote: proc-receive< issue=123
112 - remote: proc-receive< reviewer=user1
113 - remote: proc-receive> ok refs/for/main/topic
114 - remote: # post-receive hook
115 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
116 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
117 - To <URL/of/upstream.git>
118 - * [new branch] HEAD -> next
119 - * [new reference] HEAD -> refs/for/main/topic
104 + format_and_save_expect <<-EOF &&
105 + > remote: # pre-receive hook Z
106 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
107 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
108 + > remote: # proc-receive hook Z
109 + > remote: proc-receive: atomic push_options Z
110 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
111 + > remote: proc-receive< issue=123 Z
112 + > remote: proc-receive< reviewer=user1 Z
113 + > remote: proc-receive> ok refs/for/main/topic Z
114 + > remote: # post-receive hook Z
115 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
116 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
117 + > To <URL/of/upstream.git>
118 + > * [new branch] HEAD -> next
119 + > * [new reference] HEAD -> refs/for/main/topic
120 EOF
121 test_cmp expect actual &&
122
t/t5411/test-0027-push-options--porcelain.sh
+31 -31
@@ -54,20 +54,20 @@ test_expect_success "proc-receive: ignore push-options for version 0 ($PROTOCOL/
54 HEAD:refs/for/main/topic \
55 >out 2>&1 &&
56 make_user_friendly_and_stable_output <out >actual &&
57 - cat >expect <<-EOF &&
58 - remote: # pre-receive hook
59 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
60 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
61 - remote: # proc-receive hook
62 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
63 - remote: proc-receive> ok refs/for/main/topic
64 - remote: # post-receive hook
65 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
66 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
67 - To <URL/of/upstream.git>
68 - * HEAD:refs/heads/next [new branch]
69 - * HEAD:refs/for/main/topic [new reference]
70 - Done
57 + format_and_save_expect <<-EOF &&
58 + > remote: # pre-receive hook Z
59 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
60 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
61 + > remote: # proc-receive hook Z
62 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
63 + > remote: proc-receive> ok refs/for/main/topic Z
64 + > remote: # post-receive hook Z
65 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
66 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
67 + > To <URL/of/upstream.git>
68 + > * HEAD:refs/heads/next [new branch]
69 + > * HEAD:refs/for/main/topic [new reference]
70 + > Done
71 EOF
72 test_cmp expect actual &&
73
@@ -105,23 +105,23 @@ test_expect_success "proc-receive: push with options ($PROTOCOL/porcelain)" '
105 HEAD:refs/for/main/topic \
106 >out 2>&1 &&
107 make_user_friendly_and_stable_output <out >actual &&
108 - cat >expect <<-EOF &&
109 - remote: # pre-receive hook
110 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
111 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
112 - remote: # proc-receive hook
113 - remote: proc-receive: atomic push_options
114 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
115 - remote: proc-receive< issue=123
116 - remote: proc-receive< reviewer=user1
117 - remote: proc-receive> ok refs/for/main/topic
118 - remote: # post-receive hook
119 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
120 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
121 - To <URL/of/upstream.git>
122 - * HEAD:refs/heads/next [new branch]
123 - * HEAD:refs/for/main/topic [new reference]
124 - Done
108 + format_and_save_expect <<-EOF &&
109 + > remote: # pre-receive hook Z
110 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
111 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
112 + > remote: # proc-receive hook Z
113 + > remote: proc-receive: atomic push_options Z
114 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
115 + > remote: proc-receive< issue=123 Z
116 + > remote: proc-receive< reviewer=user1 Z
117 + > remote: proc-receive> ok refs/for/main/topic Z
118 + > remote: # post-receive hook Z
119 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
120 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
121 + > To <URL/of/upstream.git>
122 + > * HEAD:refs/heads/next [new branch]
123 + > * HEAD:refs/for/main/topic [new reference]
124 + > Done
125 EOF
126 test_cmp expect actual &&
127
t/t5411/test-0030-report-ok.sh
+10 -10
@@ -14,16 +14,16 @@ test_expect_success "proc-receive: ok ($PROTOCOL)" '
14 HEAD:refs/for/main/topic \
15 >out 2>&1 &&
16 make_user_friendly_and_stable_output <out >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: proc-receive> ok refs/for/main/topic
23 - remote: # post-receive hook
24 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
25 - To <URL/of/upstream.git>
26 - * [new reference] HEAD -> refs/for/main/topic
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: proc-receive> ok refs/for/main/topic Z
23 + > remote: # post-receive hook Z
24 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
25 + > To <URL/of/upstream.git>
26 + > * [new reference] HEAD -> refs/for/main/topic
27 EOF
28 test_cmp expect actual &&
29
t/t5411/test-0031-report-ok--porcelain.sh
+11 -11
@@ -14,17 +14,17 @@ test_expect_success "proc-receive: ok ($PROTOCOL/porcelain)" '
14 HEAD:refs/for/main/topic \
15 >out 2>&1 &&
16 make_user_friendly_and_stable_output <out >actual &&
17 - cat >expect <<-EOF &&
18 - remote: # pre-receive hook
19 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
20 - remote: # proc-receive hook
21 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
22 - remote: proc-receive> ok refs/for/main/topic
23 - remote: # post-receive hook
24 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
25 - To <URL/of/upstream.git>
26 - * HEAD:refs/for/main/topic [new reference]
27 - Done
17 + format_and_save_expect <<-EOF &&
18 + > remote: # pre-receive hook Z
19 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
20 + > remote: # proc-receive hook Z
21 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
22 + > remote: proc-receive> ok refs/for/main/topic Z
23 + > remote: # post-receive hook Z
24 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
25 + > To <URL/of/upstream.git>
26 + > * HEAD:refs/for/main/topic [new reference]
27 + > Done
28 EOF
29 test_cmp expect actual &&
30
t/t5411/test-0032-report-with-options.sh
+93 -93
@@ -15,16 +15,16 @@ test_expect_success "proc-receive: report option without matching ok ($PROTOCOL)
15 HEAD:refs/for/main/topic \
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
21 - remote: # proc-receive hook
22 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
23 - remote: proc-receive> option refname refs/pull/123/head
24 - remote: proc-receive> option old-oid <COMMIT-B>
25 - remote: error: proc-receive reported "option" without a matching "ok/ng" directive
26 - To <URL/of/upstream.git>
27 - ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
18 + format_and_save_expect <<-EOF &&
19 + > remote: # pre-receive hook Z
20 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
21 + > remote: # proc-receive hook Z
22 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
23 + > remote: proc-receive> option refname refs/pull/123/head Z
24 + > remote: proc-receive> option old-oid <COMMIT-B> Z
25 + > remote: error: proc-receive reported "option" without a matching "ok/ng" directive Z
26 + > To <URL/of/upstream.git>
27 + > ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)
28 EOF
29 test_cmp expect actual
30 '
@@ -46,17 +46,17 @@ test_expect_success "proc-receive: report option refname ($PROTOCOL)" '
46 HEAD:refs/for/main/topic \
47 >out 2>&1 &&
48 make_user_friendly_and_stable_output <out >actual &&
49 - cat >expect <<-EOF &&
50 - remote: # pre-receive hook
51 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
52 - remote: # proc-receive hook
53 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
54 - remote: proc-receive> ok refs/for/main/topic
55 - remote: proc-receive> option refname refs/pull/123/head
56 - remote: # post-receive hook
57 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
58 - To <URL/of/upstream.git>
59 - * [new reference] HEAD -> refs/pull/123/head
49 + format_and_save_expect <<-EOF &&
50 + > remote: # pre-receive hook Z
51 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
52 + > remote: # proc-receive hook Z
53 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
54 + > remote: proc-receive> ok refs/for/main/topic Z
55 + > remote: proc-receive> option refname refs/pull/123/head Z
56 + > remote: # post-receive hook Z
57 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
58 + > To <URL/of/upstream.git>
59 + > * [new reference] HEAD -> refs/pull/123/head
60 EOF
61 test_cmp expect actual
62 '
@@ -78,18 +78,18 @@ test_expect_success "proc-receive: report option refname and forced-update ($PRO
78 HEAD:refs/for/main/topic \
79 >out 2>&1 &&
80 make_user_friendly_and_stable_output <out >actual &&
81 - cat >expect <<-EOF &&
82 - remote: # pre-receive hook
83 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
84 - remote: # proc-receive hook
85 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
86 - remote: proc-receive> ok refs/for/main/topic
87 - remote: proc-receive> option refname refs/pull/123/head
88 - remote: proc-receive> option forced-update
89 - remote: # post-receive hook
90 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
91 - To <URL/of/upstream.git>
92 - * [new reference] HEAD -> refs/pull/123/head
81 + format_and_save_expect <<-EOF &&
82 + > remote: # pre-receive hook Z
83 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
84 + > remote: # proc-receive hook Z
85 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
86 + > remote: proc-receive> ok refs/for/main/topic Z
87 + > remote: proc-receive> option refname refs/pull/123/head Z
88 + > remote: proc-receive> option forced-update Z
89 + > remote: # post-receive hook Z
90 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
91 + > To <URL/of/upstream.git>
92 + > * [new reference] HEAD -> refs/pull/123/head
93 EOF
94 test_cmp expect actual
95 '
@@ -112,18 +112,18 @@ test_expect_success "proc-receive: report option refname and old-oid ($PROTOCOL)
112 HEAD:refs/for/main/topic \
113 >out 2>&1 &&
114 make_user_friendly_and_stable_output <out >actual &&
115 - cat >expect <<-EOF &&
116 - remote: # pre-receive hook
117 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
118 - remote: # proc-receive hook
119 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
120 - remote: proc-receive> ok refs/for/main/topic
121 - remote: proc-receive> option refname refs/pull/123/head
122 - remote: proc-receive> option old-oid <COMMIT-B>
123 - remote: # post-receive hook
124 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head
125 - To <URL/of/upstream.git>
126 - <OID-B>..<OID-A> HEAD -> refs/pull/123/head
115 + format_and_save_expect <<-EOF &&
116 + > remote: # pre-receive hook Z
117 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
118 + > remote: # proc-receive hook Z
119 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
120 + > remote: proc-receive> ok refs/for/main/topic Z
121 + > remote: proc-receive> option refname refs/pull/123/head Z
122 + > remote: proc-receive> option old-oid <COMMIT-B> Z
123 + > remote: # post-receive hook Z
124 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head Z
125 + > To <URL/of/upstream.git>
126 + > <OID-B>..<OID-A> HEAD -> refs/pull/123/head
127 EOF
128 test_cmp expect actual
129 '
@@ -145,17 +145,17 @@ test_expect_success "proc-receive: report option old-oid ($PROTOCOL)" '
145 HEAD:refs/for/main/topic \
146 >out 2>&1 &&
147 make_user_friendly_and_stable_output <out >actual &&
148 - cat >expect <<-EOF &&
149 - remote: # pre-receive hook
150 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
151 - remote: # proc-receive hook
152 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
153 - remote: proc-receive> ok refs/for/main/topic
154 - remote: proc-receive> option old-oid <COMMIT-B>
155 - remote: # post-receive hook
156 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic
157 - To <URL/of/upstream.git>
158 - <OID-B>..<OID-A> HEAD -> refs/for/main/topic
148 + format_and_save_expect <<-EOF &&
149 + > remote: # pre-receive hook Z
150 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
151 + > remote: # proc-receive hook Z
152 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
153 + > remote: proc-receive> ok refs/for/main/topic Z
154 + > remote: proc-receive> option old-oid <COMMIT-B> Z
155 + > remote: # post-receive hook Z
156 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic Z
157 + > To <URL/of/upstream.git>
158 + > <OID-B>..<OID-A> HEAD -> refs/for/main/topic
159 EOF
160 test_cmp expect actual
161 '
@@ -178,18 +178,18 @@ test_expect_success "proc-receive: report option old-oid and new-oid ($PROTOCOL)
178 HEAD:refs/for/main/topic \
179 >out 2>&1 &&
180 make_user_friendly_and_stable_output <out >actual &&
181 - cat >expect <<-EOF &&
182 - remote: # pre-receive hook
183 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
184 - remote: # proc-receive hook
185 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
186 - remote: proc-receive> ok refs/for/main/topic
187 - remote: proc-receive> option old-oid <COMMIT-A>
188 - remote: proc-receive> option new-oid <COMMIT-B>
189 - remote: # post-receive hook
190 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
191 - To <URL/of/upstream.git>
192 - <OID-A>..<OID-B> HEAD -> refs/for/main/topic
181 + format_and_save_expect <<-EOF &&
182 + > remote: # pre-receive hook Z
183 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
184 + > remote: # proc-receive hook Z
185 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
186 + > remote: proc-receive> ok refs/for/main/topic Z
187 + > remote: proc-receive> option old-oid <COMMIT-A> Z
188 + > remote: proc-receive> option new-oid <COMMIT-B> Z
189 + > remote: # post-receive hook Z
190 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
191 + > To <URL/of/upstream.git>
192 + > <OID-A>..<OID-B> HEAD -> refs/for/main/topic
193 EOF
194 test_cmp expect actual
195 '
@@ -219,31 +219,31 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL)" '
219 HEAD:refs/for/main/topic \
220 >out 2>&1 &&
221 make_user_friendly_and_stable_output <out >actual &&
222 - cat >expect <<-EOF &&
223 - remote: # pre-receive hook
224 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
225 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
226 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
227 - remote: # proc-receive hook
228 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
229 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
230 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
231 - remote: proc-receive> ok refs/for/a/b/c/topic
232 - remote: proc-receive> ok refs/for/next/topic
233 - remote: proc-receive> option refname refs/pull/123/head
234 - remote: proc-receive> ok refs/for/main/topic
235 - remote: proc-receive> option refname refs/pull/124/head
236 - remote: proc-receive> option old-oid <COMMIT-B>
237 - remote: proc-receive> option forced-update
238 - remote: proc-receive> option new-oid <COMMIT-A>
239 - remote: # post-receive hook
240 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
241 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
242 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head
243 - To <URL/of/upstream.git>
244 - * [new reference] HEAD -> refs/pull/123/head
245 - * [new reference] HEAD -> refs/for/a/b/c/topic
246 - + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)
222 + format_and_save_expect <<-EOF &&
223 + > remote: # pre-receive hook Z
224 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
225 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
226 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
227 + > remote: # proc-receive hook Z
228 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
229 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
230 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
231 + > remote: proc-receive> ok refs/for/a/b/c/topic Z
232 + > remote: proc-receive> ok refs/for/next/topic Z
233 + > remote: proc-receive> option refname refs/pull/123/head Z
234 + > remote: proc-receive> ok refs/for/main/topic Z
235 + > remote: proc-receive> option refname refs/pull/124/head Z
236 + > remote: proc-receive> option old-oid <COMMIT-B> Z
237 + > remote: proc-receive> option forced-update Z
238 + > remote: proc-receive> option new-oid <COMMIT-A> Z
239 + > remote: # post-receive hook Z
240 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
241 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
242 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head Z
243 + > To <URL/of/upstream.git>
244 + > * [new reference] HEAD -> refs/pull/123/head
245 + > * [new reference] HEAD -> refs/for/a/b/c/topic
246 + > + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)
247 EOF
248 test_cmp expect actual &&
249
t/t5411/test-0033-report-with-options--porcelain.sh
+100 -100
@@ -15,17 +15,17 @@ test_expect_success "proc-receive: report option without matching ok ($PROTOCOL/
15 HEAD:refs/for/main/topic \
16 >out-$test_count 2>&1 &&
17 make_user_friendly_and_stable_output <out-$test_count >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
21 - remote: # proc-receive hook
22 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
23 - remote: proc-receive> option refname refs/pull/123/head
24 - remote: proc-receive> option old-oid <COMMIT-B>
25 - remote: error: proc-receive reported "option" without a matching "ok/ng" directive
26 - To <URL/of/upstream.git>
27 - ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
28 - Done
18 + format_and_save_expect <<-EOF &&
19 + > remote: # pre-receive hook Z
20 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
21 + > remote: # proc-receive hook Z
22 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
23 + > remote: proc-receive> option refname refs/pull/123/head Z
24 + > remote: proc-receive> option old-oid <COMMIT-B> Z
25 + > remote: error: proc-receive reported "option" without a matching "ok/ng" directive Z
26 + > To <URL/of/upstream.git>
27 + > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
28 + > Done
29 EOF
30 test_cmp expect actual
31 '
@@ -47,18 +47,18 @@ test_expect_success "proc-receive: report option refname ($PROTOCOL/porcelain)"
47 HEAD:refs/for/main/topic \
48 >out 2>&1 &&
49 make_user_friendly_and_stable_output <out >actual &&
50 - cat >expect <<-EOF &&
51 - remote: # pre-receive hook
52 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
53 - remote: # proc-receive hook
54 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
55 - remote: proc-receive> ok refs/for/main/topic
56 - remote: proc-receive> option refname refs/pull/123/head
57 - remote: # post-receive hook
58 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
59 - To <URL/of/upstream.git>
60 - * HEAD:refs/pull/123/head [new reference]
61 - Done
50 + format_and_save_expect <<-EOF &&
51 + > remote: # pre-receive hook Z
52 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
53 + > remote: # proc-receive hook Z
54 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
55 + > remote: proc-receive> ok refs/for/main/topic Z
56 + > remote: proc-receive> option refname refs/pull/123/head Z
57 + > remote: # post-receive hook Z
58 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
59 + > To <URL/of/upstream.git>
60 + > * HEAD:refs/pull/123/head [new reference]
61 + > Done
62 EOF
63 test_cmp expect actual
64 '
@@ -81,19 +81,19 @@ test_expect_success "proc-receive: report option refname and forced-update ($PRO
81 HEAD:refs/for/main/topic \
82 >out 2>&1 &&
83 make_user_friendly_and_stable_output <out >actual &&
84 - cat >expect <<-EOF &&
85 - remote: # pre-receive hook
86 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
87 - remote: # proc-receive hook
88 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
89 - remote: proc-receive> ok refs/for/main/topic
90 - remote: proc-receive> option refname refs/pull/123/head
91 - remote: proc-receive> option forced-update
92 - remote: # post-receive hook
93 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
94 - To <URL/of/upstream.git>
95 - * HEAD:refs/pull/123/head [new reference]
96 - Done
84 + format_and_save_expect <<-EOF &&
85 + > remote: # pre-receive hook Z
86 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
87 + > remote: # proc-receive hook Z
88 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
89 + > remote: proc-receive> ok refs/for/main/topic Z
90 + > remote: proc-receive> option refname refs/pull/123/head Z
91 + > remote: proc-receive> option forced-update Z
92 + > remote: # post-receive hook Z
93 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
94 + > To <URL/of/upstream.git>
95 + > * HEAD:refs/pull/123/head [new reference]
96 + > Done
97 EOF
98 test_cmp expect actual
99 '
@@ -116,19 +116,19 @@ test_expect_success "proc-receive: report option refname and old-oid ($PROTOCOL/
116 HEAD:refs/for/main/topic \
117 >out 2>&1 &&
118 make_user_friendly_and_stable_output <out >actual &&
119 - cat >expect <<-EOF &&
120 - remote: # pre-receive hook
121 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
122 - remote: # proc-receive hook
123 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
124 - remote: proc-receive> ok refs/for/main/topic
125 - remote: proc-receive> option refname refs/pull/123/head
126 - remote: proc-receive> option old-oid <COMMIT-B>
127 - remote: # post-receive hook
128 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head
129 - To <URL/of/upstream.git>
130 - HEAD:refs/pull/123/head <OID-B>..<OID-A>
131 - Done
119 + format_and_save_expect <<-EOF &&
120 + > remote: # pre-receive hook Z
121 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
122 + > remote: # proc-receive hook Z
123 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
124 + > remote: proc-receive> ok refs/for/main/topic Z
125 + > remote: proc-receive> option refname refs/pull/123/head Z
126 + > remote: proc-receive> option old-oid <COMMIT-B> Z
127 + > remote: # post-receive hook Z
128 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head Z
129 + > To <URL/of/upstream.git>
130 + > HEAD:refs/pull/123/head <OID-B>..<OID-A>
131 + > Done
132 EOF
133 test_cmp expect actual
134 '
@@ -150,18 +150,18 @@ test_expect_success "proc-receive: report option old-oid ($PROTOCOL/porcelain)"
150 HEAD:refs/for/main/topic \
151 >out 2>&1 &&
152 make_user_friendly_and_stable_output <out >actual &&
153 - cat >expect <<-EOF &&
154 - remote: # pre-receive hook
155 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
156 - remote: # proc-receive hook
157 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
158 - remote: proc-receive> ok refs/for/main/topic
159 - remote: proc-receive> option old-oid <COMMIT-B>
160 - remote: # post-receive hook
161 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic
162 - To <URL/of/upstream.git>
163 - HEAD:refs/for/main/topic <OID-B>..<OID-A>
164 - Done
153 + format_and_save_expect <<-EOF &&
154 + > remote: # pre-receive hook Z
155 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
156 + > remote: # proc-receive hook Z
157 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
158 + > remote: proc-receive> ok refs/for/main/topic Z
159 + > remote: proc-receive> option old-oid <COMMIT-B> Z
160 + > remote: # post-receive hook Z
161 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic Z
162 + > To <URL/of/upstream.git>
163 + > HEAD:refs/for/main/topic <OID-B>..<OID-A>
164 + > Done
165 EOF
166 test_cmp expect actual
167 '
@@ -184,19 +184,19 @@ test_expect_success "proc-receive: report option old-oid and new-oid ($PROTOCOL/
184 HEAD:refs/for/main/topic \
185 >out 2>&1 &&
186 make_user_friendly_and_stable_output <out >actual &&
187 - cat >expect <<-EOF &&
188 - remote: # pre-receive hook
189 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
190 - remote: # proc-receive hook
191 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
192 - remote: proc-receive> ok refs/for/main/topic
193 - remote: proc-receive> option old-oid <COMMIT-A>
194 - remote: proc-receive> option new-oid <COMMIT-B>
195 - remote: # post-receive hook
196 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
197 - To <URL/of/upstream.git>
198 - HEAD:refs/for/main/topic <OID-A>..<OID-B>
199 - Done
187 + format_and_save_expect <<-EOF &&
188 + > remote: # pre-receive hook Z
189 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
190 + > remote: # proc-receive hook Z
191 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
192 + > remote: proc-receive> ok refs/for/main/topic Z
193 + > remote: proc-receive> option old-oid <COMMIT-A> Z
194 + > remote: proc-receive> option new-oid <COMMIT-B> Z
195 + > remote: # post-receive hook Z
196 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
197 + > To <URL/of/upstream.git>
198 + > HEAD:refs/for/main/topic <OID-A>..<OID-B>
199 + > Done
200 EOF
201 test_cmp expect actual
202 '
@@ -227,32 +227,32 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL/porc
227 HEAD:refs/for/main/topic \
228 >out 2>&1 &&
229 make_user_friendly_and_stable_output <out >actual &&
230 - cat >expect <<-EOF &&
231 - remote: # pre-receive hook
232 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
233 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
234 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
235 - remote: # proc-receive hook
236 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
237 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
238 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
239 - remote: proc-receive> ok refs/for/a/b/c/topic
240 - remote: proc-receive> ok refs/for/next/topic
241 - remote: proc-receive> option refname refs/pull/123/head
242 - remote: proc-receive> ok refs/for/main/topic
243 - remote: proc-receive> option refname refs/pull/124/head
244 - remote: proc-receive> option old-oid <COMMIT-B>
245 - remote: proc-receive> option forced-update
246 - remote: proc-receive> option new-oid <COMMIT-A>
247 - remote: # post-receive hook
248 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head
249 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic
250 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head
251 - To <URL/of/upstream.git>
252 - * HEAD:refs/pull/123/head [new reference]
253 - * HEAD:refs/for/a/b/c/topic [new reference]
254 - + HEAD:refs/pull/124/head <OID-B>...<OID-A> (forced update)
255 - Done
230 + format_and_save_expect <<-EOF &&
231 + > remote: # pre-receive hook Z
232 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
233 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
234 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
235 + > remote: # proc-receive hook Z
236 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
237 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
238 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
239 + > remote: proc-receive> ok refs/for/a/b/c/topic Z
240 + > remote: proc-receive> ok refs/for/next/topic Z
241 + > remote: proc-receive> option refname refs/pull/123/head Z
242 + > remote: proc-receive> ok refs/for/main/topic Z
243 + > remote: proc-receive> option refname refs/pull/124/head Z
244 + > remote: proc-receive> option old-oid <COMMIT-B> Z
245 + > remote: proc-receive> option forced-update Z
246 + > remote: proc-receive> option new-oid <COMMIT-A> Z
247 + > remote: # post-receive hook Z
248 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head Z
249 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic Z
250 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head Z
251 + > To <URL/of/upstream.git>
252 + > * HEAD:refs/pull/123/head [new reference]
253 + > * HEAD:refs/for/a/b/c/topic [new reference]
254 + > + HEAD:refs/pull/124/head <OID-B>...<OID-A> (forced update)
255 + > Done
256 EOF
257 test_cmp expect actual &&
258
t/t5411/test-0034-report-ft.sh
+11 -11
@@ -15,17 +15,17 @@ test_expect_success "proc-receive: fall throught, let receive-pack to execute ($
15 $B:refs/for/main/topic \
16 >out 2>&1 &&
17 make_user_friendly_and_stable_output <out >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
21 - remote: # proc-receive hook
22 - remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
23 - remote: proc-receive> ok refs/for/main/topic
24 - remote: proc-receive> option fall-through
25 - remote: # post-receive hook
26 - remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
27 - To <URL/of/upstream.git>
28 - * [new reference] <COMMIT-B> -> refs/for/main/topic
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
29 EOF
30 test_cmp expect actual &&
31
t/t5411/test-0035-report-ft--porcelain.sh
+12 -12
@@ -15,18 +15,18 @@ test_expect_success "proc-receive: fall throught, let receive-pack to execute ($
15 $B:refs/for/main/topic \
16 >out 2>&1 &&
17 make_user_friendly_and_stable_output <out >actual &&
18 - cat >expect <<-EOF &&
19 - remote: # pre-receive hook
20 - remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
21 - remote: # proc-receive hook
22 - remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
23 - remote: proc-receive> ok refs/for/main/topic
24 - remote: proc-receive> option fall-through
25 - remote: # post-receive hook
26 - remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic
27 - To <URL/of/upstream.git>
28 - * <COMMIT-B>:refs/for/main/topic [new reference]
29 - Done
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 + > * <COMMIT-B>:refs/for/main/topic [new reference]
29 + > Done
30 EOF
31 test_cmp expect actual &&
32
t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
+66 -66
@@ -39,30 +39,30 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
39 HEAD:refs/for/main/topic \
40 >out 2>&1 &&
41 make_user_friendly_and_stable_output <out >actual &&
42 - cat >expect <<-EOF &&
43 - remote: # pre-receive hook
44 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
45 - remote: # proc-receive hook
46 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
47 - remote: proc-receive> ok refs/for/main/topic
48 - remote: proc-receive> option old-oid <COMMIT-A>
49 - remote: proc-receive> option new-oid <COMMIT-B>
50 - remote: proc-receive> ok refs/for/main/topic
51 - remote: proc-receive> option refname refs/changes/24/124/1
52 - remote: proc-receive> option old-oid <ZERO-OID>
53 - remote: proc-receive> option new-oid <COMMIT-A>
54 - remote: proc-receive> ok refs/for/main/topic
55 - remote: proc-receive> option refname refs/changes/25/125/1
56 - remote: proc-receive> option old-oid <COMMIT-A>
57 - remote: proc-receive> option new-oid <COMMIT-B>
58 - remote: # post-receive hook
59 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
60 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1
61 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1
62 - To <URL/of/upstream.git>
63 - <OID-A>..<OID-B> HEAD -> refs/for/main/topic
64 - * [new reference] HEAD -> refs/changes/24/124/1
65 - <OID-A>..<OID-B> HEAD -> refs/changes/25/125/1
42 + format_and_save_expect <<-EOF &&
43 + > remote: # pre-receive hook Z
44 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
45 + > remote: # proc-receive hook Z
46 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
47 + > remote: proc-receive> ok refs/for/main/topic Z
48 + > remote: proc-receive> option old-oid <COMMIT-A> Z
49 + > remote: proc-receive> option new-oid <COMMIT-B> Z
50 + > remote: proc-receive> ok refs/for/main/topic Z
51 + > remote: proc-receive> option refname refs/changes/24/124/1 Z
52 + > remote: proc-receive> option old-oid <ZERO-OID> Z
53 + > remote: proc-receive> option new-oid <COMMIT-A> Z
54 + > remote: proc-receive> ok refs/for/main/topic Z
55 + > remote: proc-receive> option refname refs/changes/25/125/1 Z
56 + > remote: proc-receive> option old-oid <COMMIT-A> Z
57 + > remote: proc-receive> option new-oid <COMMIT-B> Z
58 + > remote: # post-receive hook Z
59 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
60 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1 Z
61 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1 Z
62 + > To <URL/of/upstream.git>
63 + > <OID-A>..<OID-B> HEAD -> refs/for/main/topic
64 + > * [new reference] HEAD -> refs/changes/24/124/1
65 + > <OID-A>..<OID-B> HEAD -> refs/changes/25/125/1
66 EOF
67 test_cmp expect actual &&
68
@@ -113,31 +113,31 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
113 HEAD:refs/for/main/topic \
114 >out 2>&1 &&
115 make_user_friendly_and_stable_output <out >actual &&
116 - cat >expect <<-EOF &&
117 - remote: # pre-receive hook
118 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
119 - remote: # proc-receive hook
120 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
121 - remote: proc-receive> ok refs/for/main/topic
122 - remote: proc-receive> option refname refs/changes/24/124/1
123 - remote: proc-receive> option old-oid <ZERO-OID>
124 - remote: proc-receive> option new-oid <COMMIT-A>
125 - remote: proc-receive> ok refs/for/main/topic
126 - remote: proc-receive> option old-oid <COMMIT-A>
127 - remote: proc-receive> option new-oid <COMMIT-B>
128 - remote: proc-receive> ok refs/for/main/topic
129 - remote: proc-receive> option refname refs/changes/25/125/1
130 - remote: proc-receive> option old-oid <COMMIT-B>
131 - remote: proc-receive> option new-oid <COMMIT-A>
132 - remote: proc-receive> option forced-update
133 - remote: # post-receive hook
134 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1
135 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
136 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1
137 - To <URL/of/upstream.git>
138 - * [new reference] HEAD -> refs/changes/24/124/1
139 - <OID-A>..<OID-B> HEAD -> refs/for/main/topic
140 - + <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)
116 + format_and_save_expect <<-EOF &&
117 + > remote: # pre-receive hook Z
118 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
119 + > remote: # proc-receive hook Z
120 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
121 + > remote: proc-receive> ok refs/for/main/topic Z
122 + > remote: proc-receive> option refname refs/changes/24/124/1 Z
123 + > remote: proc-receive> option old-oid <ZERO-OID> Z
124 + > remote: proc-receive> option new-oid <COMMIT-A> Z
125 + > remote: proc-receive> ok refs/for/main/topic Z
126 + > remote: proc-receive> option old-oid <COMMIT-A> Z
127 + > remote: proc-receive> option new-oid <COMMIT-B> Z
128 + > remote: proc-receive> ok refs/for/main/topic Z
129 + > remote: proc-receive> option refname refs/changes/25/125/1 Z
130 + > remote: proc-receive> option old-oid <COMMIT-B> Z
131 + > remote: proc-receive> option new-oid <COMMIT-A> Z
132 + > remote: proc-receive> option forced-update Z
133 + > remote: # post-receive hook Z
134 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1 Z
135 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
136 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1 Z
137 + > To <URL/of/upstream.git>
138 + > * [new reference] HEAD -> refs/changes/24/124/1
139 + > <OID-A>..<OID-B> HEAD -> refs/for/main/topic
140 + > + <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)
141 EOF
142 test_cmp expect actual &&
143
@@ -182,23 +182,23 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
182 HEAD:refs/for/main/topic \
183 >out 2>&1 &&
184 make_user_friendly_and_stable_output <out >actual &&
185 - cat >expect <<-EOF &&
186 - remote: # pre-receive hook
187 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
188 - remote: # proc-receive hook
189 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
190 - remote: proc-receive> ok refs/for/main/topic
191 - remote: proc-receive> option refname refs/changes/23/123/1
192 - remote: proc-receive> ok refs/for/main/topic
193 - remote: proc-receive> option refname refs/changes/24/124/2
194 - remote: proc-receive> option old-oid <COMMIT-A>
195 - remote: proc-receive> option new-oid <COMMIT-B>
196 - remote: # post-receive hook
197 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1
198 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2
199 - To <URL/of/upstream.git>
200 - * [new reference] HEAD -> refs/changes/23/123/1
201 - <OID-A>..<OID-B> HEAD -> refs/changes/24/124/2
185 + format_and_save_expect <<-EOF &&
186 + > remote: # pre-receive hook Z
187 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
188 + > remote: # proc-receive hook Z
189 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
190 + > remote: proc-receive> ok refs/for/main/topic Z
191 + > remote: proc-receive> option refname refs/changes/23/123/1 Z
192 + > remote: proc-receive> ok refs/for/main/topic Z
193 + > remote: proc-receive> option refname refs/changes/24/124/2 Z
194 + > remote: proc-receive> option old-oid <COMMIT-A> Z
195 + > remote: proc-receive> option new-oid <COMMIT-B> Z
196 + > remote: # post-receive hook Z
197 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1 Z
198 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2 Z
199 + > To <URL/of/upstream.git>
200 + > * [new reference] HEAD -> refs/changes/23/123/1
201 + > <OID-A>..<OID-B> HEAD -> refs/changes/24/124/2
202 EOF
203 test_cmp expect actual &&
204
t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh
+69 -69
@@ -24,31 +24,31 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
24 HEAD:refs/for/main/topic \
25 >out 2>&1 &&
26 make_user_friendly_and_stable_output <out >actual &&
27 - cat >expect <<-EOF &&
28 - remote: # pre-receive hook
29 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
30 - remote: # proc-receive hook
31 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
32 - remote: proc-receive> ok refs/for/main/topic
33 - remote: proc-receive> option old-oid <COMMIT-A>
34 - remote: proc-receive> option new-oid <COMMIT-B>
35 - remote: proc-receive> ok refs/for/main/topic
36 - remote: proc-receive> option refname refs/changes/24/124/1
37 - remote: proc-receive> option old-oid <ZERO-OID>
38 - remote: proc-receive> option new-oid <COMMIT-A>
39 - remote: proc-receive> ok refs/for/main/topic
40 - remote: proc-receive> option refname refs/changes/25/125/1
41 - remote: proc-receive> option old-oid <COMMIT-A>
42 - remote: proc-receive> option new-oid <COMMIT-B>
43 - remote: # post-receive hook
44 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
45 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1
46 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1
47 - To <URL/of/upstream.git>
48 - HEAD:refs/for/main/topic <OID-A>..<OID-B>
49 - * HEAD:refs/changes/24/124/1 [new reference]
50 - HEAD:refs/changes/25/125/1 <OID-A>..<OID-B>
51 - Done
27 + format_and_save_expect <<-EOF &&
28 + > remote: # pre-receive hook Z
29 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
30 + > remote: # proc-receive hook Z
31 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
32 + > remote: proc-receive> ok refs/for/main/topic Z
33 + > remote: proc-receive> option old-oid <COMMIT-A> Z
34 + > remote: proc-receive> option new-oid <COMMIT-B> Z
35 + > remote: proc-receive> ok refs/for/main/topic Z
36 + > remote: proc-receive> option refname refs/changes/24/124/1 Z
37 + > remote: proc-receive> option old-oid <ZERO-OID> Z
38 + > remote: proc-receive> option new-oid <COMMIT-A> Z
39 + > remote: proc-receive> ok refs/for/main/topic Z
40 + > remote: proc-receive> option refname refs/changes/25/125/1 Z
41 + > remote: proc-receive> option old-oid <COMMIT-A> Z
42 + > remote: proc-receive> option new-oid <COMMIT-B> Z
43 + > remote: # post-receive hook Z
44 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
45 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1 Z
46 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1 Z
47 + > To <URL/of/upstream.git>
48 + > HEAD:refs/for/main/topic <OID-A>..<OID-B>
49 + > * HEAD:refs/changes/24/124/1 [new reference]
50 + > HEAD:refs/changes/25/125/1 <OID-A>..<OID-B>
51 + > Done
52 EOF
53 test_cmp expect actual &&
54
@@ -84,32 +84,32 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
84 HEAD:refs/for/main/topic \
85 >out 2>&1 &&
86 make_user_friendly_and_stable_output <out >actual &&
87 - cat >expect <<-EOF &&
88 - remote: # pre-receive hook
89 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
90 - remote: # proc-receive hook
91 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
92 - remote: proc-receive> ok refs/for/main/topic
93 - remote: proc-receive> option refname refs/changes/24/124/1
94 - remote: proc-receive> option old-oid <ZERO-OID>
95 - remote: proc-receive> option new-oid <COMMIT-A>
96 - remote: proc-receive> ok refs/for/main/topic
97 - remote: proc-receive> option old-oid <COMMIT-A>
98 - remote: proc-receive> option new-oid <COMMIT-B>
99 - remote: proc-receive> ok refs/for/main/topic
100 - remote: proc-receive> option refname refs/changes/25/125/1
101 - remote: proc-receive> option old-oid <COMMIT-B>
102 - remote: proc-receive> option new-oid <COMMIT-A>
103 - remote: proc-receive> option forced-update
104 - remote: # post-receive hook
105 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1
106 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
107 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1
108 - To <URL/of/upstream.git>
109 - * HEAD:refs/changes/24/124/1 [new reference]
110 - HEAD:refs/for/main/topic <OID-A>..<OID-B>
111 - + HEAD:refs/changes/25/125/1 <OID-B>...<OID-A> (forced update)
112 - Done
87 + format_and_save_expect <<-EOF &&
88 + > remote: # pre-receive hook Z
89 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
90 + > remote: # proc-receive hook Z
91 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
92 + > remote: proc-receive> ok refs/for/main/topic Z
93 + > remote: proc-receive> option refname refs/changes/24/124/1 Z
94 + > remote: proc-receive> option old-oid <ZERO-OID> Z
95 + > remote: proc-receive> option new-oid <COMMIT-A> Z
96 + > remote: proc-receive> ok refs/for/main/topic Z
97 + > remote: proc-receive> option old-oid <COMMIT-A> Z
98 + > remote: proc-receive> option new-oid <COMMIT-B> Z
99 + > remote: proc-receive> ok refs/for/main/topic Z
100 + > remote: proc-receive> option refname refs/changes/25/125/1 Z
101 + > remote: proc-receive> option old-oid <COMMIT-B> Z
102 + > remote: proc-receive> option new-oid <COMMIT-A> Z
103 + > remote: proc-receive> option forced-update Z
104 + > remote: # post-receive hook Z
105 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1 Z
106 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
107 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1 Z
108 + > To <URL/of/upstream.git>
109 + > * HEAD:refs/changes/24/124/1 [new reference]
110 + > HEAD:refs/for/main/topic <OID-A>..<OID-B>
111 + > + HEAD:refs/changes/25/125/1 <OID-B>...<OID-A> (forced update)
112 + > Done
113 EOF
114 test_cmp expect actual &&
115
@@ -139,24 +139,24 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL/porc
139 HEAD:refs/for/main/topic \
140 >out 2>&1 &&
141 make_user_friendly_and_stable_output <out >actual &&
142 - cat >expect <<-EOF &&
143 - remote: # pre-receive hook
144 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
145 - remote: # proc-receive hook
146 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
147 - remote: proc-receive> ok refs/for/main/topic
148 - remote: proc-receive> option refname refs/changes/23/123/1
149 - remote: proc-receive> ok refs/for/main/topic
150 - remote: proc-receive> option refname refs/changes/24/124/2
151 - remote: proc-receive> option old-oid <COMMIT-A>
152 - remote: proc-receive> option new-oid <COMMIT-B>
153 - remote: # post-receive hook
154 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1
155 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2
156 - To <URL/of/upstream.git>
157 - * HEAD:refs/changes/23/123/1 [new reference]
158 - HEAD:refs/changes/24/124/2 <OID-A>..<OID-B>
159 - Done
142 + format_and_save_expect <<-EOF &&
143 + > remote: # pre-receive hook Z
144 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
145 + > remote: # proc-receive hook Z
146 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
147 + > remote: proc-receive> ok refs/for/main/topic Z
148 + > remote: proc-receive> option refname refs/changes/23/123/1 Z
149 + > remote: proc-receive> ok refs/for/main/topic Z
150 + > remote: proc-receive> option refname refs/changes/24/124/2 Z
151 + > remote: proc-receive> option old-oid <COMMIT-A> Z
152 + > remote: proc-receive> option new-oid <COMMIT-B> Z
153 + > remote: # post-receive hook Z
154 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1 Z
155 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2 Z
156 + > To <URL/of/upstream.git>
157 + > * HEAD:refs/changes/23/123/1 [new reference]
158 + > HEAD:refs/changes/24/124/2 <OID-A>..<OID-B>
159 + > Done
160 EOF
161 test_cmp expect actual &&
162
t/t5411/test-0038-report-mixed-refs.sh
+37 -37
@@ -26,43 +26,43 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL)" '
26 HEAD:refs/for/next/topic3 \
27 >out-$test_count 2>&1 &&
28 make_user_friendly_and_stable_output <out-$test_count >actual &&
29 - cat >expect <<-EOF &&
30 - remote: # pre-receive hook
31 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
32 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar
33 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz
34 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
35 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1
36 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
37 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
38 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3
39 - remote: # proc-receive hook
40 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
41 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1
42 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
43 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3
44 - remote: proc-receive> ok refs/for/next/topic2
45 - remote: proc-receive> ng refs/for/next/topic1 fail to call Web API
46 - remote: proc-receive> ok refs/for/main/topic
47 - remote: proc-receive> option refname refs/for/main/topic
48 - remote: proc-receive> option old-oid <COMMIT-A>
49 - remote: proc-receive> option new-oid <COMMIT-B>
50 - remote: # post-receive hook
51 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
52 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar
53 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz
54 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
55 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
56 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
57 - To <URL/of/upstream.git>
58 - <OID-A>..<OID-B> <COMMIT-B> -> main
59 - * [new branch] HEAD -> bar
60 - * [new branch] HEAD -> baz
61 - * [new reference] HEAD -> refs/for/next/topic2
62 - * [new branch] HEAD -> foo
63 - <OID-A>..<OID-B> HEAD -> refs/for/main/topic
64 - ! [remote rejected] HEAD -> refs/for/next/topic1 (fail to call Web API)
65 - ! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)
29 + format_and_save_expect <<-EOF &&
30 + > remote: # pre-receive hook Z
31 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
32 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z
33 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z
34 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
35 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z
36 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z
37 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
38 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z
39 + > remote: # proc-receive hook Z
40 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
41 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z
42 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
43 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z
44 + > remote: proc-receive> ok refs/for/next/topic2 Z
45 + > remote: proc-receive> ng refs/for/next/topic1 fail to call Web API Z
46 + > remote: proc-receive> ok refs/for/main/topic Z
47 + > remote: proc-receive> option refname refs/for/main/topic Z
48 + > remote: proc-receive> option old-oid <COMMIT-A> Z
49 + > remote: proc-receive> option new-oid <COMMIT-B> Z
50 + > remote: # post-receive hook Z
51 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
52 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z
53 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z
54 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
55 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z
56 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
57 + > To <URL/of/upstream.git>
58 + > <OID-A>..<OID-B> <COMMIT-B> -> main
59 + > * [new branch] HEAD -> bar
60 + > * [new branch] HEAD -> baz
61 + > * [new reference] HEAD -> refs/for/next/topic2
62 + > * [new branch] HEAD -> foo
63 + > <OID-A>..<OID-B> HEAD -> refs/for/main/topic
64 + > ! [remote rejected] HEAD -> refs/for/next/topic1 (fail to call Web API)
65 + > ! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)
66 EOF
67 test_cmp expect actual &&
68
t/t5411/test-0039-report-mixed-refs--porcelain.sh
+38 -38
@@ -26,44 +26,44 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcel
26 HEAD:refs/for/next/topic3 \
27 >out-$test_count 2>&1 &&
28 make_user_friendly_and_stable_output <out-$test_count >actual &&
29 - cat >expect <<-EOF &&
30 - remote: # pre-receive hook
31 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
32 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar
33 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz
34 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
35 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1
36 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
37 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
38 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3
39 - remote: # proc-receive hook
40 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
41 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1
42 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
43 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3
44 - remote: proc-receive> ok refs/for/next/topic2
45 - remote: proc-receive> ng refs/for/next/topic1 fail to call Web API
46 - remote: proc-receive> ok refs/for/main/topic
47 - remote: proc-receive> option refname refs/for/main/topic
48 - remote: proc-receive> option old-oid <COMMIT-A>
49 - remote: proc-receive> option new-oid <COMMIT-B>
50 - remote: # post-receive hook
51 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
52 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar
53 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz
54 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2
55 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo
56 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic
57 - To <URL/of/upstream.git>
58 - <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
59 - * HEAD:refs/heads/bar [new branch]
60 - * HEAD:refs/heads/baz [new branch]
61 - * HEAD:refs/for/next/topic2 [new reference]
62 - * HEAD:refs/heads/foo [new branch]
63 - HEAD:refs/for/main/topic <OID-A>..<OID-B>
64 - ! HEAD:refs/for/next/topic1 [remote rejected] (fail to call Web API)
65 - ! HEAD:refs/for/next/topic3 [remote rejected] (proc-receive failed to report status)
66 - Done
29 + format_and_save_expect <<-EOF &&
30 + > remote: # pre-receive hook Z
31 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
32 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z
33 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z
34 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
35 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z
36 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z
37 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
38 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z
39 + > remote: # proc-receive hook Z
40 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
41 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1 Z
42 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
43 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3 Z
44 + > remote: proc-receive> ok refs/for/next/topic2 Z
45 + > remote: proc-receive> ng refs/for/next/topic1 fail to call Web API Z
46 + > remote: proc-receive> ok refs/for/main/topic Z
47 + > remote: proc-receive> option refname refs/for/main/topic Z
48 + > remote: proc-receive> option old-oid <COMMIT-A> Z
49 + > remote: proc-receive> option new-oid <COMMIT-B> Z
50 + > remote: # post-receive hook Z
51 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
52 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar Z
53 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz Z
54 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2 Z
55 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo Z
56 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic Z
57 + > To <URL/of/upstream.git>
58 + > <COMMIT-B>:refs/heads/main <OID-A>..<OID-B>
59 + > * HEAD:refs/heads/bar [new branch]
60 + > * HEAD:refs/heads/baz [new branch]
61 + > * HEAD:refs/for/next/topic2 [new reference]
62 + > * HEAD:refs/heads/foo [new branch]
63 + > HEAD:refs/for/main/topic <OID-A>..<OID-B>
64 + > ! HEAD:refs/for/next/topic1 [remote rejected] (fail to call Web API)
65 + > ! HEAD:refs/for/next/topic3 [remote rejected] (proc-receive failed to report status)
66 + > Done
67 EOF
68 test_cmp expect actual &&
69
t/t5411/test-0040-process-all-refs.sh
+40 -40
@@ -50,46 +50,46 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL)" '
50 HEAD:refs/for/next/topic \
51 >out 2>&1 &&
52 make_user_friendly_and_stable_output <out >actual &&
53 - cat >expect <<-EOF &&
54 - remote: # pre-receive hook
55 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
56 - remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
57 - remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
58 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
59 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
60 - remote: # proc-receive hook
61 - remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
62 - remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
63 - remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
64 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
65 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
66 - remote: proc-receive> ok refs/heads/main
67 - remote: proc-receive> option fall-through
68 - remote: proc-receive> ok refs/heads/foo
69 - remote: proc-receive> option fall-through
70 - remote: proc-receive> ok refs/heads/bar
71 - remote: proc-receive> option fall-through
72 - remote: proc-receive> ok refs/for/main/topic
73 - remote: proc-receive> option refname refs/pull/123/head
74 - remote: proc-receive> option old-oid <COMMIT-A>
75 - remote: proc-receive> option new-oid <COMMIT-B>
76 - remote: proc-receive> ok refs/for/next/topic
77 - remote: proc-receive> option refname refs/pull/124/head
78 - remote: proc-receive> option old-oid <COMMIT-B>
79 - remote: proc-receive> option new-oid <COMMIT-A>
80 - remote: proc-receive> option forced-update
81 - remote: # post-receive hook
82 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
83 - remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
84 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
85 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head
86 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head
87 - To <URL/of/upstream.git>
88 - <OID-A>..<OID-B> <COMMIT-B> -> bar
89 - - [deleted] foo
90 - + <OID-B>...<OID-A> HEAD -> main (forced update)
91 - <OID-A>..<OID-B> HEAD -> refs/pull/123/head
92 - + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)
53 + format_and_save_expect <<-EOF &&
54 + > remote: # pre-receive hook Z
55 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
56 + > remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
57 + > remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
58 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
59 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
60 + > remote: # proc-receive hook Z
61 + > remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
62 + > remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
63 + > remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
64 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
65 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
66 + > remote: proc-receive> ok refs/heads/main Z
67 + > remote: proc-receive> option fall-through Z
68 + > remote: proc-receive> ok refs/heads/foo Z
69 + > remote: proc-receive> option fall-through Z
70 + > remote: proc-receive> ok refs/heads/bar Z
71 + > remote: proc-receive> option fall-through Z
72 + > remote: proc-receive> ok refs/for/main/topic Z
73 + > remote: proc-receive> option refname refs/pull/123/head Z
74 + > remote: proc-receive> option old-oid <COMMIT-A> Z
75 + > remote: proc-receive> option new-oid <COMMIT-B> Z
76 + > remote: proc-receive> ok refs/for/next/topic Z
77 + > remote: proc-receive> option refname refs/pull/124/head Z
78 + > remote: proc-receive> option old-oid <COMMIT-B> Z
79 + > remote: proc-receive> option new-oid <COMMIT-A> Z
80 + > remote: proc-receive> option forced-update Z
81 + > remote: # post-receive hook Z
82 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
83 + > remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
84 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
85 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head Z
86 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head Z
87 + > To <URL/of/upstream.git>
88 + > <OID-A>..<OID-B> <COMMIT-B> -> bar
89 + > - [deleted] foo
90 + > + <OID-B>...<OID-A> HEAD -> main (forced update)
91 + > <OID-A>..<OID-B> HEAD -> refs/pull/123/head
92 + > + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)
93 EOF
94 test_cmp expect actual &&
95
t/t5411/test-0041-process-all-refs--porcelain.sh
+41 -41
@@ -50,47 +50,47 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL/porcelain)" '
50 HEAD:refs/for/next/topic \
51 >out 2>&1 &&
52 make_user_friendly_and_stable_output <out >actual &&
53 - cat >expect <<-EOF &&
54 - remote: # pre-receive hook
55 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
56 - remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
57 - remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
58 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
59 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
60 - remote: # proc-receive hook
61 - remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
62 - remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
63 - remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
64 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
65 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic
66 - remote: proc-receive> ok refs/heads/main
67 - remote: proc-receive> option fall-through
68 - remote: proc-receive> ok refs/heads/foo
69 - remote: proc-receive> option fall-through
70 - remote: proc-receive> ok refs/heads/bar
71 - remote: proc-receive> option fall-through
72 - remote: proc-receive> ok refs/for/main/topic
73 - remote: proc-receive> option refname refs/pull/123/head
74 - remote: proc-receive> option old-oid <COMMIT-A>
75 - remote: proc-receive> option new-oid <COMMIT-B>
76 - remote: proc-receive> ok refs/for/next/topic
77 - remote: proc-receive> option refname refs/pull/124/head
78 - remote: proc-receive> option old-oid <COMMIT-B>
79 - remote: proc-receive> option new-oid <COMMIT-A>
80 - remote: proc-receive> option forced-update
81 - remote: # post-receive hook
82 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar
83 - remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo
84 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main
85 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head
86 - remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head
87 - To <URL/of/upstream.git>
88 - <COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
89 - - :refs/heads/foo [deleted]
90 - + HEAD:refs/heads/main <OID-B>...<OID-A> (forced update)
91 - HEAD:refs/pull/123/head <OID-A>..<OID-B>
92 - + HEAD:refs/pull/124/head <OID-B>...<OID-A> (forced update)
93 - Done
53 + format_and_save_expect <<-EOF &&
54 + > remote: # pre-receive hook Z
55 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
56 + > remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
57 + > remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
58 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
59 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
60 + > remote: # proc-receive hook Z
61 + > remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
62 + > remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
63 + > remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
64 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic Z
65 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic Z
66 + > remote: proc-receive> ok refs/heads/main Z
67 + > remote: proc-receive> option fall-through Z
68 + > remote: proc-receive> ok refs/heads/foo Z
69 + > remote: proc-receive> option fall-through Z
70 + > remote: proc-receive> ok refs/heads/bar Z
71 + > remote: proc-receive> option fall-through Z
72 + > remote: proc-receive> ok refs/for/main/topic Z
73 + > remote: proc-receive> option refname refs/pull/123/head Z
74 + > remote: proc-receive> option old-oid <COMMIT-A> Z
75 + > remote: proc-receive> option new-oid <COMMIT-B> Z
76 + > remote: proc-receive> ok refs/for/next/topic Z
77 + > remote: proc-receive> option refname refs/pull/124/head Z
78 + > remote: proc-receive> option old-oid <COMMIT-B> Z
79 + > remote: proc-receive> option new-oid <COMMIT-A> Z
80 + > remote: proc-receive> option forced-update Z
81 + > remote: # post-receive hook Z
82 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar Z
83 + > remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo Z
84 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main Z
85 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head Z
86 + > remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head Z
87 + > To <URL/of/upstream.git>
88 + > <COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
89 + > - :refs/heads/foo [deleted]
90 + > + HEAD:refs/heads/main <OID-B>...<OID-A> (forced update)
91 + > HEAD:refs/pull/123/head <OID-A>..<OID-B>
92 + > + HEAD:refs/pull/124/head <OID-B>...<OID-A> (forced update)
93 + > Done
94 EOF
95 test_cmp expect actual &&
96
t/t5411/test-0050-proc-receive-refs-with-modifiers.sh
+45 -45
@@ -29,25 +29,25 @@ test_expect_success "proc-receive: update branch and new tag ($PROTOCOL)" '
29 $B:refs/heads/main \
30 v123 >out 2>&1 &&
31 make_user_friendly_and_stable_output <out >actual &&
32 - cat >expect <<-EOF &&
33 - remote: # pre-receive hook
34 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
35 - remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
36 - remote: # proc-receive hook
37 - remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
38 - remote: proc-receive< <ZERO-OID> <TAG-v123> refs/tags/v123
39 - remote: proc-receive> ok refs/heads/main
40 - remote: proc-receive> option refname refs/pull/123/head
41 - remote: proc-receive> option old-oid <COMMIT-A>
42 - remote: proc-receive> option new-oid <COMMIT-B>
43 - remote: proc-receive> ok refs/tags/v123
44 - remote: proc-receive> option refname refs/pull/124/head
45 - remote: # post-receive hook
46 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head
47 - remote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head
48 - To <URL/of/upstream.git>
49 - <OID-A>..<OID-B> <COMMIT-B> -> refs/pull/123/head
50 - * [new reference] v123 -> refs/pull/124/head
32 + format_and_save_expect <<-EOF &&
33 + > remote: # pre-receive hook Z
34 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
35 + > remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
36 + > remote: # proc-receive hook Z
37 + > remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/main Z
38 + > remote: proc-receive< <ZERO-OID> <TAG-v123> refs/tags/v123 Z
39 + > remote: proc-receive> ok refs/heads/main Z
40 + > remote: proc-receive> option refname refs/pull/123/head Z
41 + > remote: proc-receive> option old-oid <COMMIT-A> Z
42 + > remote: proc-receive> option new-oid <COMMIT-B> Z
43 + > remote: proc-receive> ok refs/tags/v123 Z
44 + > remote: proc-receive> option refname refs/pull/124/head Z
45 + > remote: # post-receive hook Z
46 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head Z
47 + > remote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head Z
48 + > To <URL/of/upstream.git>
49 + > <OID-A>..<OID-B> <COMMIT-B> -> refs/pull/123/head
50 + > * [new reference] v123 -> refs/pull/124/head
51 EOF
52 test_cmp expect actual &&
53
@@ -93,32 +93,32 @@ test_expect_success "proc-receive: create/delete branch, and delete tag ($PROTOC
93 $A:refs/heads/next \
94 :refs/tags/v123 >out 2>&1 &&
95 make_user_friendly_and_stable_output <out >actual &&
96 - cat >expect <<-EOF &&
97 - remote: # pre-receive hook
98 - remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/main
99 - remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic
100 - remote: pre-receive< <TAG-v123> <ZERO-OID> refs/tags/v123
101 - remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
102 - remote: # proc-receive hook
103 - remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/main
104 - remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
105 - remote: proc-receive> ok refs/heads/main
106 - remote: proc-receive> option refname refs/pull/123/head
107 - remote: proc-receive> option old-oid <COMMIT-A>
108 - remote: proc-receive> option new-oid <ZERO-OID>
109 - remote: proc-receive> ok refs/heads/next
110 - remote: proc-receive> option refname refs/pull/124/head
111 - remote: proc-receive> option new-oid <COMMIT-A>
112 - remote: # post-receive hook
113 - remote: post-receive< <COMMIT-A> <ZERO-OID> refs/pull/123/head
114 - remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic
115 - remote: post-receive< <TAG-v123> <ZERO-OID> refs/tags/v123
116 - remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head
117 - To <URL/of/upstream.git>
118 - - [deleted] refs/pull/123/head
119 - <OID-A>..<OID-B> <COMMIT-B> -> topic
120 - - [deleted] v123
121 - * [new reference] <COMMIT-A> -> refs/pull/124/head
96 + format_and_save_expect <<-EOF &&
97 + > remote: # pre-receive hook Z
98 + > remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/main Z
99 + > remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic Z
100 + > remote: pre-receive< <TAG-v123> <ZERO-OID> refs/tags/v123 Z
101 + > remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
102 + > remote: # proc-receive hook Z
103 + > remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/main Z
104 + > remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/heads/next Z
105 + > remote: proc-receive> ok refs/heads/main Z
106 + > remote: proc-receive> option refname refs/pull/123/head Z
107 + > remote: proc-receive> option old-oid <COMMIT-A> Z
108 + > remote: proc-receive> option new-oid <ZERO-OID> Z
109 + > remote: proc-receive> ok refs/heads/next Z
110 + > remote: proc-receive> option refname refs/pull/124/head Z
111 + > remote: proc-receive> option new-oid <COMMIT-A> Z
112 + > remote: # post-receive hook Z
113 + > remote: post-receive< <COMMIT-A> <ZERO-OID> refs/pull/123/head Z
114 + > remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic Z
115 + > remote: post-receive< <TAG-v123> <ZERO-OID> refs/tags/v123 Z
116 + > remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head Z
117 + > To <URL/of/upstream.git>
118 + > - [deleted] refs/pull/123/head
119 + > <OID-A>..<OID-B> <COMMIT-B> -> topic
120 + > - [deleted] v123
121 + > * [new reference] <COMMIT-A> -> refs/pull/124/head
122 EOF
123 test_cmp expect actual &&
124
t/t5548-push-porcelain.sh
+28 -26
@@ -45,9 +45,6 @@ create_commits_in () {
45 # of the output.
46 make_user_friendly_and_stable_output () {
47 sed \
48 - -e "s/ *\$//" \
49 - -e "s/ */ /g" \
50 - -e "s/ / /g" \
48 -e "s/$A/<COMMIT-A>/g" \
49 -e "s/$B/<COMMIT-B>/g" \
50 -e "s/$ZERO_OID/<ZERO-OID>/g" \
@@ -56,6 +53,10 @@ make_user_friendly_and_stable_output () {
53 -e "s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#"
54 }
55
56 +format_and_save_expect () {
57 + sed -e 's/^> //' -e 's/Z$//' >expect
58 +}
59 +
60 setup_upstream_and_workbench () {
61 # Upstream after setup : main(B) foo(A) bar(A) baz(A)
62 # Workbench after setup : main(A)
@@ -111,14 +112,14 @@ run_git_push_porcelain_output_test() {
112 next
113 ) >out &&
114 make_user_friendly_and_stable_output <out >actual &&
114 - cat >expect <<-EOF &&
115 - To <URL/of/upstream.git>
116 - = refs/heads/baz:refs/heads/baz [up to date]
117 - <COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
118 - - :refs/heads/foo [deleted]
119 - + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
120 - * refs/heads/next:refs/heads/next [new branch]
121 - Done
115 + format_and_save_expect <<-EOF &&
116 + > To <URL/of/upstream.git>
117 + > = refs/heads/baz:refs/heads/baz [up to date]
118 + > <COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
119 + > - :refs/heads/foo [deleted]
120 + > + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
121 + > * refs/heads/next:refs/heads/next [new branch]
122 + > Done
123 EOF
124 test_cmp expect actual &&
125
@@ -148,12 +149,12 @@ run_git_push_porcelain_output_test() {
149 next
150 ) >out &&
151 make_user_friendly_and_stable_output <out >actual &&
151 - cat >expect <<-EOF &&
152 + format_and_save_expect <<-EOF &&
153 To <URL/of/upstream.git>
153 - = refs/heads/next:refs/heads/next [up to date]
154 - ! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
155 - ! (delete):refs/heads/baz [rejected] (atomic push failed)
156 - ! refs/heads/main:refs/heads/main [rejected] (atomic push failed)
154 + > = refs/heads/next:refs/heads/next [up to date]
155 + > ! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
156 + > ! (delete):refs/heads/baz [rejected] (atomic push failed)
157 + > ! refs/heads/main:refs/heads/main [rejected] (atomic push failed)
158 Done
159 EOF
160 test_cmp expect actual &&
@@ -168,6 +169,7 @@ run_git_push_porcelain_output_test() {
169 EOF
170 test_cmp expect actual
171 '
172 +
173 test_expect_success "prepare pre-receive hook ($PROTOCOL)" '
174 write_script "$upstream/hooks/pre-receive" <<-EOF
175 exit 1
@@ -189,12 +191,12 @@ run_git_push_porcelain_output_test() {
191 next
192 ) >out &&
193 make_user_friendly_and_stable_output <out >actual &&
192 - cat >expect <<-EOF &&
194 + format_and_save_expect <<-EOF &&
195 To <URL/of/upstream.git>
194 - = refs/heads/next:refs/heads/next [up to date]
195 - ! refs/heads/bar:refs/heads/bar [remote rejected] (pre-receive hook declined)
196 - ! :refs/heads/baz [remote rejected] (pre-receive hook declined)
197 - ! refs/heads/main:refs/heads/main [remote rejected] (pre-receive hook declined)
196 + > = refs/heads/next:refs/heads/next [up to date]
197 + > ! refs/heads/bar:refs/heads/bar [remote rejected] (pre-receive hook declined)
198 + > ! :refs/heads/baz [remote rejected] (pre-receive hook declined)
199 + > ! refs/heads/main:refs/heads/main [remote rejected] (pre-receive hook declined)
200 Done
201 EOF
202 test_cmp expect actual &&
@@ -227,12 +229,12 @@ run_git_push_porcelain_output_test() {
229 next
230 ) >out &&
231 make_user_friendly_and_stable_output <out >actual &&
230 - cat >expect <<-EOF &&
232 + format_and_save_expect <<-EOF &&
233 To <URL/of/upstream.git>
232 - = refs/heads/next:refs/heads/next [up to date]
233 - - :refs/heads/baz [deleted]
234 - refs/heads/main:refs/heads/main <OID-A>..<OID-B>
235 - ! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
234 + > = refs/heads/next:refs/heads/next [up to date]
235 + > - :refs/heads/baz [deleted]
236 + > refs/heads/main:refs/heads/main <OID-A>..<OID-B>
237 + > ! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
238 Done
239 EOF
240 test_cmp expect actual &&
t/t6020-bundle-misc.sh
+24 -21
@@ -82,7 +82,7 @@ test_commit_setvar () {
82
83 # Format the output of git commands to make a user-friendly and stable
84 # text. We can easily prepare the expect text without having to worry
85 -# about future changes of the commit ID and spaces of the output.
85 +# about future changes of the commit ID.
86 make_user_friendly_and_stable_output () {
87 sed \
88 -e "s/${A%${A#???????}}[0-9a-f]*/<COMMIT-A>/g" \
@@ -103,8 +103,11 @@ make_user_friendly_and_stable_output () {
103 -e "s/${P%${P#???????}}[0-9a-f]*/<COMMIT-P>/g" \
104 -e "s/${TAG1%${TAG1#???????}}[0-9a-f]*/<TAG-1>/g" \
105 -e "s/${TAG2%${TAG2#???????}}[0-9a-f]*/<TAG-2>/g" \
106 - -e "s/${TAG3%${TAG3#???????}}[0-9a-f]*/<TAG-3>/g" \
107 - -e "s/ *\$//"
106 + -e "s/${TAG3%${TAG3#???????}}[0-9a-f]*/<TAG-3>/g"
107 +}
108 +
109 +format_and_save_expect () {
110 + sed -e 's/Z$//' >expect
111 }
112
113 # (C) (D, pull/1/head, topic/1)
@@ -179,11 +182,11 @@ test_expect_success 'create bundle from special rev: main^!' '
182
183 git bundle verify special-rev.bdl |
184 make_user_friendly_and_stable_output >actual &&
182 - cat >expect <<-\EOF &&
185 + format_and_save_expect <<-\EOF &&
186 The bundle contains this ref:
187 <COMMIT-P> refs/heads/main
188 The bundle requires this ref:
186 - <COMMIT-O>
189 + <COMMIT-O> Z
190 EOF
191 test_cmp expect actual &&
192
@@ -200,12 +203,12 @@ test_expect_success 'create bundle with --max-count option' '
203
204 git bundle verify max-count.bdl |
205 make_user_friendly_and_stable_output >actual &&
203 - cat >expect <<-\EOF &&
206 + format_and_save_expect <<-\EOF &&
207 The bundle contains these 2 refs:
208 <COMMIT-P> refs/heads/main
209 <TAG-1> refs/tags/v1
210 The bundle requires this ref:
208 - <COMMIT-O>
211 + <COMMIT-O> Z
212 EOF
213 test_cmp expect actual &&
214
@@ -225,7 +228,7 @@ test_expect_success 'create bundle with --since option' '
228
229 git bundle verify since.bdl |
230 make_user_friendly_and_stable_output >actual &&
228 - cat >expect <<-\EOF &&
231 + format_and_save_expect <<-\EOF &&
232 The bundle contains these 5 refs:
233 <COMMIT-P> refs/heads/main
234 <COMMIT-N> refs/heads/release
@@ -233,8 +236,8 @@ test_expect_success 'create bundle with --since option' '
236 <TAG-3> refs/tags/v3
237 <COMMIT-P> HEAD
238 The bundle requires these 2 refs:
236 - <COMMIT-M>
237 - <COMMIT-K>
239 + <COMMIT-M> Z
240 + <COMMIT-K> Z
241 EOF
242 test_cmp expect actual &&
243
@@ -293,13 +296,13 @@ test_expect_success 'create bundle 2 - has prerequisites' '
296 --stdin \
297 release <input &&
298
296 - cat >expect <<-\EOF &&
299 + format_and_save_expect <<-\EOF &&
300 The bundle contains this ref:
301 <COMMIT-N> refs/heads/release
302 The bundle requires these 3 refs:
300 - <COMMIT-D>
301 - <COMMIT-E>
302 - <COMMIT-G>
303 + <COMMIT-D> Z
304 + <COMMIT-E> Z
305 + <COMMIT-G> Z
306 EOF
307
308 git bundle verify 2.bdl |
@@ -317,11 +320,11 @@ test_expect_success 'create bundle 2 - has prerequisites' '
320 test_expect_success 'fail to verify bundle without prerequisites' '
321 git init --bare test1.git &&
322
320 - cat >expect <<-\EOF &&
323 + format_and_save_expect <<-\EOF &&
324 error: Repository lacks these prerequisite commits:
322 - error: <COMMIT-D>
323 - error: <COMMIT-E>
324 - error: <COMMIT-G>
325 + error: <COMMIT-D> Z
326 + error: <COMMIT-E> Z
327 + error: <COMMIT-G> Z
328 EOF
329
330 test_must_fail git -C test1.git bundle verify ../2.bdl 2>&1 |
@@ -352,13 +355,13 @@ test_expect_success 'create bundle 3 - two refs, same object' '
355 --stdin \
356 main HEAD <input &&
357
355 - cat >expect <<-\EOF &&
358 + format_and_save_expect <<-\EOF &&
359 The bundle contains these 2 refs:
360 <COMMIT-P> refs/heads/main
361 <COMMIT-P> HEAD
362 The bundle requires these 2 refs:
360 - <COMMIT-M>
361 - <COMMIT-K>
363 + <COMMIT-M> Z
364 + <COMMIT-K> Z
365 EOF
366
367 git bundle verify 3.bdl |