test: refactor to use "get_abbrev_oid" to get abbrev oid

Add new function "get_abbrev_oid" to get abbrev object ID. This function has a default value which helps to prepare a nonempty replace pattern for sed command. An empty replace pattern may cause sed fail to allocate memory. Refactor function "make_user_friendly_and_stable_output" to use "get_abbrev_oid" to get abbrev object ID. 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 12d6991cf417465d567c38ba8ae7d59bda7a202f
15 files changed +72 -52
t/t5411/common-functions.sh
+15 -5
@@ -18,6 +18,18 @@ create_commits_in () {
18 done
19 }
20
21 +get_abbrev_oid () {
22 + oid=$1 &&
23 + suffix=${oid#???????} &&
24 + oid=${oid%$suffix} &&
25 + if test -n "$oid"
26 + then
27 + echo "$oid"
28 + else
29 + echo "undefined-oid"
30 + fi
31 +}
32 +
33 # Format the output of git-push, git-show-ref and other commands to make a
34 # user-friendly and stable text. We can easily prepare the expect text
35 # without having to worry about changes of the commit ID (full or abbrev.)
@@ -28,12 +40,10 @@ create_commits_in () {
40 make_user_friendly_and_stable_output () {
41 sed \
42 -e "s/'/\"/g" \
31 - -e "s/$A/<COMMIT-A>/g" \
32 - -e "s/$B/<COMMIT-B>/g" \
33 - -e "s/$TAG/<TAG-v123>/g" \
43 + -e "s/$(get_abbrev_oid $A)[0-9a-f]*/<COMMIT-A>/g" \
44 + -e "s/$(get_abbrev_oid $B)[0-9a-f]*/<COMMIT-B>/g" \
45 + -e "s/$(get_abbrev_oid $TAG)[0-9a-f]*/<TAG-v123>/g" \
46 -e "s/$ZERO_OID/<ZERO-OID>/g" \
35 - -e "s/$(echo $A | cut -c1-7)[0-9a-f]*/<OID-A>/g" \
36 - -e "s/$(echo $B | cut -c1-7)[0-9a-f]*/<OID-B>/g" \
47 -e "s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#" \
48 -e "/^error: / d"
49 }
t/t5411/test-0000-standard-git-push.sh
+3 -3
@@ -15,7 +15,7 @@ test_expect_success "git-push ($PROTOCOL)" '
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
18 + > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> main
19 > * [new branch] HEAD -> next
20 EOF
21 test_cmp expect actual &&
@@ -69,7 +69,7 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL)" '
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
72 + > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> next
73 > ! [rejected] main -> main (non-fast-forward)
74 EOF
75 test_cmp expect actual &&
@@ -106,7 +106,7 @@ test_expect_success "git-push -f ($PROTOCOL)" '
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)
109 + > + <COMMIT-B>...<COMMIT-A> main -> main (forced update)
110 > - [deleted] next
111 > * [new tag] v123 -> v123
112 > * [new reference] main -> refs/review/main/topic
t/t5411/test-0001-standard-git-push--porcelain.sh
+3 -3
@@ -15,7 +15,7 @@ test_expect_success "git-push ($PROTOCOL/porcelain)" '
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>
18 + > <COMMIT-B>:refs/heads/main <COMMIT-A>..<COMMIT-B>
19 > * HEAD:refs/heads/next [new branch]
20 > Done
21 EOF
@@ -71,7 +71,7 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
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>
74 + > <COMMIT-B>:refs/heads/next <COMMIT-A>..<COMMIT-B>
75 > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
76 > Done
77 EOF
@@ -109,7 +109,7 @@ test_expect_success "git-push -f ($PROTOCOL/porcelain)" '
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)
112 + > + refs/heads/main:refs/heads/main <COMMIT-B>...<COMMIT-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]
t/t5411/test-0022-report-unexpect-ref.sh
+1 -1
@@ -26,7 +26,7 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL)" '
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
29 + > <COMMIT-A>..<COMMIT-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 &&
t/t5411/test-0023-report-unexpect-ref--porcelain.sh
+1 -1
@@ -26,7 +26,7 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)"
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>
29 + > <COMMIT-B>:refs/heads/main <COMMIT-A>..<COMMIT-B>
30 > ! HEAD:refs/for/main/topic [remote rejected] (proc-receive failed to report status)
31 > Done
32 EOF
t/t5411/test-0032-report-with-options.sh
+4 -4
@@ -123,7 +123,7 @@ test_expect_success "proc-receive: report option refname and old-oid ($PROTOCOL)
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
126 + > <COMMIT-B>..<COMMIT-A> HEAD -> refs/pull/123/head
127 EOF
128 test_cmp expect actual
129 '
@@ -155,7 +155,7 @@ test_expect_success "proc-receive: report option old-oid ($PROTOCOL)" '
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
158 + > <COMMIT-B>..<COMMIT-A> HEAD -> refs/for/main/topic
159 EOF
160 test_cmp expect actual
161 '
@@ -189,7 +189,7 @@ test_expect_success "proc-receive: report option old-oid and new-oid ($PROTOCOL)
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
192 + > <COMMIT-A>..<COMMIT-B> HEAD -> refs/for/main/topic
193 EOF
194 test_cmp expect actual
195 '
@@ -243,7 +243,7 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL)" '
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)
246 + > + <COMMIT-B>...<COMMIT-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
+4 -4
@@ -127,7 +127,7 @@ test_expect_success "proc-receive: report option refname and old-oid ($PROTOCOL/
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>
130 + > HEAD:refs/pull/123/head <COMMIT-B>..<COMMIT-A>
131 > Done
132 EOF
133 test_cmp expect actual
@@ -160,7 +160,7 @@ test_expect_success "proc-receive: report option old-oid ($PROTOCOL/porcelain)"
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>
163 + > HEAD:refs/for/main/topic <COMMIT-B>..<COMMIT-A>
164 > Done
165 EOF
166 test_cmp expect actual
@@ -195,7 +195,7 @@ test_expect_success "proc-receive: report option old-oid and new-oid ($PROTOCOL/
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>
198 + > HEAD:refs/for/main/topic <COMMIT-A>..<COMMIT-B>
199 > Done
200 EOF
201 test_cmp expect actual
@@ -251,7 +251,7 @@ test_expect_success "proc-receive: report with multiple rewrites ($PROTOCOL/porc
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)
254 + > + HEAD:refs/pull/124/head <COMMIT-B>...<COMMIT-A> (forced update)
255 > Done
256 EOF
257 test_cmp expect actual &&
t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
+5 -5
@@ -60,9 +60,9 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
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
63 + > <COMMIT-A>..<COMMIT-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
65 + > <COMMIT-A>..<COMMIT-B> HEAD -> refs/changes/25/125/1
66 EOF
67 test_cmp expect actual &&
68
@@ -136,8 +136,8 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
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)
139 + > <COMMIT-A>..<COMMIT-B> HEAD -> refs/for/main/topic
140 + > + <COMMIT-B>...<COMMIT-A> HEAD -> refs/changes/25/125/1 (forced update)
141 EOF
142 test_cmp expect actual &&
143
@@ -198,7 +198,7 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
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
201 + > <COMMIT-A>..<COMMIT-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
+5 -5
@@ -45,9 +45,9 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
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>
48 + > HEAD:refs/for/main/topic <COMMIT-A>..<COMMIT-B>
49 > * HEAD:refs/changes/24/124/1 [new reference]
50 - > HEAD:refs/changes/25/125/1 <OID-A>..<OID-B>
50 + > HEAD:refs/changes/25/125/1 <COMMIT-A>..<COMMIT-B>
51 > Done
52 EOF
53 test_cmp expect actual &&
@@ -107,8 +107,8 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
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)
110 + > HEAD:refs/for/main/topic <COMMIT-A>..<COMMIT-B>
111 + > + HEAD:refs/changes/25/125/1 <COMMIT-B>...<COMMIT-A> (forced update)
112 > Done
113 EOF
114 test_cmp expect actual &&
@@ -155,7 +155,7 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL/porc
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>
158 + > HEAD:refs/changes/24/124/2 <COMMIT-A>..<COMMIT-B>
159 > Done
160 EOF
161 test_cmp expect actual &&
t/t5411/test-0038-report-mixed-refs.sh
+2 -2
@@ -55,12 +55,12 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL)" '
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
58 + > <COMMIT-A>..<COMMIT-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
63 + > <COMMIT-A>..<COMMIT-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
t/t5411/test-0039-report-mixed-refs--porcelain.sh
+2 -2
@@ -55,12 +55,12 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcel
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>
58 + > <COMMIT-B>:refs/heads/main <COMMIT-A>..<COMMIT-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>
63 + > HEAD:refs/for/main/topic <COMMIT-A>..<COMMIT-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
t/t5411/test-0040-process-all-refs.sh
+4 -4
@@ -85,11 +85,11 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL)" '
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
88 + > <COMMIT-A>..<COMMIT-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)
90 + > + <COMMIT-B>...<COMMIT-A> HEAD -> main (forced update)
91 + > <COMMIT-A>..<COMMIT-B> HEAD -> refs/pull/123/head
92 + > + <COMMIT-B>...<COMMIT-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
+4 -4
@@ -85,11 +85,11 @@ test_expect_success "proc-receive: process all refs ($PROTOCOL/porcelain)" '
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>
88 + > <COMMIT-B>:refs/heads/bar <COMMIT-A>..<COMMIT-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)
90 + > + HEAD:refs/heads/main <COMMIT-B>...<COMMIT-A> (forced update)
91 + > HEAD:refs/pull/123/head <COMMIT-A>..<COMMIT-B>
92 + > + HEAD:refs/pull/124/head <COMMIT-B>...<COMMIT-A> (forced update)
93 > Done
94 EOF
95 test_cmp expect actual &&
t/t5411/test-0050-proc-receive-refs-with-modifiers.sh
+2 -2
@@ -46,7 +46,7 @@ test_expect_success "proc-receive: update branch and new tag ($PROTOCOL)" '
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
49 + > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> refs/pull/123/head
50 > * [new reference] v123 -> refs/pull/124/head
51 EOF
52 test_cmp expect actual &&
@@ -116,7 +116,7 @@ test_expect_success "proc-receive: create/delete branch, and delete tag ($PROTOC
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
119 + > <COMMIT-A>..<COMMIT-B> <COMMIT-B> -> topic
120 > - [deleted] v123
121 > * [new reference] <COMMIT-A> -> refs/pull/124/head
122 EOF
t/t5548-push-porcelain.sh
+17 -7
@@ -26,17 +26,27 @@ create_commits_in () {
26 done
27 }
28
29 +get_abbrev_oid () {
30 + oid=$1 &&
31 + suffix=${oid#???????} &&
32 + oid=${oid%$suffix} &&
33 + if test -n "$oid"
34 + then
35 + echo "$oid"
36 + else
37 + echo "undefined-oid"
38 + fi
39 +}
40 +
41 # Format the output of git-push, git-show-ref and other commands to make a
42 # user-friendly and stable text. We can easily prepare the expect text
43 # without having to worry about future changes of the commit ID and spaces
44 # of the output.
45 make_user_friendly_and_stable_output () {
46 sed \
35 - -e "s/$A/<COMMIT-A>/g" \
36 - -e "s/$B/<COMMIT-B>/g" \
47 + -e "s/$(get_abbrev_oid $A)[0-9a-f]*/<COMMIT-A>/g" \
48 + -e "s/$(get_abbrev_oid $B)[0-9a-f]*/<COMMIT-B>/g" \
49 -e "s/$ZERO_OID/<ZERO-OID>/g" \
38 - -e "s/$(echo $A | cut -c1-7)[0-9a-f]*/<OID-A>/g" \
39 - -e "s/$(echo $B | cut -c1-7)[0-9a-f]*/<OID-B>/g" \
50 -e "s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#"
51 }
52
@@ -102,9 +112,9 @@ run_git_push_porcelain_output_test() {
112 format_and_save_expect <<-EOF &&
113 > To <URL/of/upstream.git>
114 > = refs/heads/baz:refs/heads/baz [up to date]
105 - > <COMMIT-B>:refs/heads/bar <OID-A>..<OID-B>
115 + > <COMMIT-B>:refs/heads/bar <COMMIT-A>..<COMMIT-B>
116 > - :refs/heads/foo [deleted]
107 - > + refs/heads/main:refs/heads/main <OID-B>...<OID-A> (forced update)
117 + > + refs/heads/main:refs/heads/main <COMMIT-B>...<COMMIT-A> (forced update)
118 > * refs/heads/next:refs/heads/next [new branch]
119 > Done
120 EOF
@@ -220,7 +230,7 @@ run_git_push_porcelain_output_test() {
230 To <URL/of/upstream.git>
231 > = refs/heads/next:refs/heads/next [up to date]
232 > - :refs/heads/baz [deleted]
223 - > refs/heads/main:refs/heads/main <OID-A>..<OID-B>
233 + > refs/heads/main:refs/heads/main <COMMIT-A>..<COMMIT-B>
234 > ! refs/heads/bar:refs/heads/bar [rejected] (non-fast-forward)
235 Done
236 EOF