Subject: Re: [PATCH v2 1/6] t5548: new test cases for push --porcelain and --dry-run

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 25 Nov 2024 09:26:25 +0100

On Fri, Nov 15, 2024 at 01:15:32AM +0800, Jiang Xin wrote:
> From: Jiang Xin <[email-masked]>
> 
> Refactor t5548 and add new test cases for git-push with both --porcelain
> and --dry-run flags in order to cover the issues reported by Patrick.
> 
> 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), where it was printed
> "unless any errors have occurred". For the purpose of the "Done" line,
> knowing a ref will be rejected in a --dry-run does not count as an
> error. Actual rejections in non --dry-run pushes do count as errors.
> 
> The new test cases will be used in the next commit to protect the above
> behaviors of porcelain output of git push.

It's a bit hard to make sense of this commit: does it introduce new
tests? Does it refactor existing tests? Does it change the test setup?
It seems to be a mixture of all of these, which makes it hard to see
what the actual change is.

I'd propose to split up this commit into multiple ones: one that
introduces `restore_upstream()`, one that adapts the test data, and one
that introduces new tests.

Patrick