mbox series

[v2,0/6] fix behaviors of git-push --porcelain

Message ID cover.1731603991.git.zhiyou.jx@alibaba-inc.com (mailing list archive)
Headers show
Series fix behaviors of git-push --porcelain | expand

Message

Jiang Xin Nov. 14, 2024, 5:15 p.m. UTC
From: Jiang Xin <zhiyou.jx@alibaba-inc.com>

When executing git-push(1) with the "--porcelain" flag, then we will
print updated references in a machine-readable format that looks
like this:

    To destination
    =   refs/heads/noop:refs/heads/noop [up to date]
    !   refs/heads/rejected:refs/heads/rejected [rejected] (atomic push
    failed)
    !   refs/heads/noff:refs/heads/(off (non-fast-forward)
    Done

The final "Done" stanza was introduced via 77555854be (git-push:
make git push --porcelain print "Done", 2010-02-26), with the
following behaviors:

 - Show a "Done" porcelain message if there are no errors.
 - Fail to update a ref in a --dry-run does not count as an error.
 - Actual rejections in non --dry-run pushes do count as errors.
 - Return a non-zero exit code if there are errors.

This patch series try to fix the broken behaviors introduced in
commit 7dcbeaa0df (send-pack: fix inconsistent porcelain output,
2020-04-17).

--

Jiang Xin (4):
  t5548: new test cases for push --porcelain and --dry-run
  push: fix the behavior of the Done message for porcelain
  push: only ignore finish_connect() for dry-run mode
  push: not send push-options to server with --dry-run

Patrick Steinhardt (2):
  t5504: modernize test by moving heredocs into test bodies
  t5543: atomic push reports exit code failure

 send-pack.c                                   |  13 +-
 .../test-0001-standard-git-push--porcelain.sh |   1 -
 ...st-0003-pre-receive-declined--porcelain.sh |   1 -
 t/t5411/test-0012-no-hook-error--porcelain.sh |   2 -
 t/t5411/test-0014-bad-protocol--porcelain.sh  |   9 -
 t/t5411/test-0021-report-ng--porcelain.sh     |   2 -
 ...est-0023-report-unexpect-ref--porcelain.sh |   1 -
 ...test-0025-report-unknown-ref--porcelain.sh |   1 -
 ...est-0033-report-with-options--porcelain.sh |   1 -
 .../test-0039-report-mixed-refs--porcelain.sh |   1 -
 t/t5504-fetch-receive-strict.sh               |  34 +-
 t/t5516-fetch-push.sh                         |   3 +-
 t/t5534-push-signed.sh                        |   1 -
 t/t5541-http-push-smart.sh                    |   1 -
 t/t5543-atomic-push.sh                        |  30 ++
 t/t5548-push-porcelain.sh                     | 335 +++++++++++++-----
 transport.c                                   |  21 +-
 17 files changed, 316 insertions(+), 141 deletions(-)