Git fork

t5548: add new porcelain test cases

Add two more test cases exercising git-push(1) with `--procelain`, one
exercising a non-atomic and one exercising an atomic push.

Based-on-patch-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
2329b6b4 bc0f5939

+68
+68
t/t5548-push-porcelain.sh
··· 133 133 # Refs of upstream : main(B) foo(A) bar(A) baz(A) 134 134 # Refs of workbench: main(A) baz(A) next(A) 135 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 + 167 + # Refs of upstream : main(B) foo(A) bar(A) baz(A) 168 + # Refs of workbench: main(A) baz(A) next(A) 169 + # git-push : main(A) NULL (B) baz(A) next(A) 136 170 test_expect_success ".. git-push --porcelain --force ($PROTOCOL)" ' 137 171 test_when_finished "setup_upstream \"$upstream\"" && 138 172 git -C workbench push --porcelain --force origin \ ··· 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 \ ··· 262 297 <COMMIT-A> refs/heads/baz 263 298 <COMMIT-A> refs/heads/foo 264 299 <COMMIT-B> refs/heads/main 300 + <COMMIT-A> refs/heads/next 301 + EOF 302 + test_cmp expect actual 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 265 333 <COMMIT-A> refs/heads/next 266 334 EOF 267 335 test_cmp expect actual