@@ -130,6 +130,40 @@ run_git_push_porcelain_output_test() {
130
130
;;
131
131
esac
132
132
133
+ # Refs of upstream : main(B) foo(A) bar(A) baz(A)
134
+ # Refs of workbench: main(A) baz(A) next(A)
135
+ # git-push : main(A) NULL (B) baz(A) next(A)
136
+ test_expect_success " .. git-push --porcelain ($PROTOCOL )" '
137
+ test_when_finished "setup_upstream \"$upstream\"" &&
138
+ test_must_fail git -C workbench push --porcelain origin \
139
+ main \
140
+ :refs/heads/foo \
141
+ $B:bar \
142
+ baz \
143
+ next >out &&
144
+ make_user_friendly_and_stable_output <out >actual &&
145
+ format_and_save_expect <<-\EOF &&
146
+ > To <URL/of/upstream.git>
147
+ > = refs/heads/baz:refs/heads/baz [up to date]
148
+ > <COMMIT-B>:refs/heads/bar <COMMIT-A>..<COMMIT-B>
149
+ > - :refs/heads/foo [deleted]
150
+ > * refs/heads/next:refs/heads/next [new branch]
151
+ > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
152
+ > Done
153
+ EOF
154
+ test_cmp expect actual &&
155
+
156
+ git -C "$upstream" show-ref >out &&
157
+ make_user_friendly_and_stable_output <out >actual &&
158
+ cat >expect <<-EOF &&
159
+ <COMMIT-B> refs/heads/bar
160
+ <COMMIT-A> refs/heads/baz
161
+ <COMMIT-B> refs/heads/main
162
+ <COMMIT-A> refs/heads/next
163
+ EOF
164
+ test_cmp expect actual
165
+ '
166
+
133
167
# Refs of upstream : main(B) foo(A) bar(A) baz(A)
134
168
# Refs of workbench: main(A) baz(A) next(A)
135
169
# git-push : main(A) NULL (B) baz(A) next(A)
@@ -240,6 +274,7 @@ run_git_push_porcelain_output_test() {
240
274
# Refs of workbench: main(A) baz(A) next(A)
241
275
# git-push : main(A) next(A)
242
276
test_expect_success " .. non-fastforward push ($PROTOCOL )" '
277
+ test_when_finished "setup_upstream \"$upstream\"" &&
243
278
(
244
279
cd workbench &&
245
280
test_must_fail git push --porcelain origin \
@@ -266,6 +301,39 @@ run_git_push_porcelain_output_test() {
266
301
EOF
267
302
test_cmp expect actual
268
303
'
304
+
305
+ # Refs of upstream : main(B) foo(A) bar(A) baz(A)
306
+ # Refs of workbench: main(A) baz(A) next(A)
307
+ # git-push : main(A) NULL (B) baz(A) next(A)
308
+ test_expect_success " .. git push --porcelain --atomic --force ($PROTOCOL )" '
309
+ git -C workbench push --porcelain --atomic --force origin \
310
+ main \
311
+ :refs/heads/foo \
312
+ $B:bar \
313
+ baz \
314
+ next >out &&
315
+ make_user_friendly_and_stable_output <out >actual &&
316
+ format_and_save_expect <<-\EOF &&
317
+ > To <URL/of/upstream.git>
318
+ > = refs/heads/baz:refs/heads/baz [up to date]
319
+ > <COMMIT-B>:refs/heads/bar <COMMIT-A>..<COMMIT-B>
320
+ > - :refs/heads/foo [deleted]
321
+ > + refs/heads/main:refs/heads/main <COMMIT-B>...<COMMIT-A> (forced update)
322
+ > * refs/heads/next:refs/heads/next [new branch]
323
+ > Done
324
+ EOF
325
+ test_cmp expect actual &&
326
+
327
+ git -C "$upstream" show-ref >out &&
328
+ make_user_friendly_and_stable_output <out >actual &&
329
+ cat >expect <<-EOF &&
330
+ <COMMIT-B> refs/heads/bar
331
+ <COMMIT-A> refs/heads/baz
332
+ <COMMIT-A> refs/heads/main
333
+ <COMMIT-A> refs/heads/next
334
+ EOF
335
+ test_cmp expect actual
336
+ '
269
337
}
270
338
271
339
setup_upstream_and_workbench upstream.git
0 commit comments