Re: [PATCH 6/6] receive-pack: utilize rejected ref error details
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jan 15, 2026, 15:21 UTC
- Message-ID
- <CAOLa=ZSCAJ-XPWK6vg3p7TO=3T3y8CD+VY4jqn41X2wbdmoaMg@mail.gmail.com>
- In-Reply-To
- <20260114180306.GI885771@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 36 quoted lines
> On Wed, Jan 14, 2026 at 04:40:47PM +0100, Karthik Nayak wrote:
>
>> In 9d2962a7c4 (receive-pack: use batched reference updates, 2025-05-19),
>> git-receive-pack(1) switched to using batched reference updates. This also
>> introduced a regression wherein instead of providing detailed error
>> messages for failed referenced updates, the users were provided generic
>> error messages based on the error type.
>>
>> Similar to the previous commit, switch to using detailed error messages
>> if present for failed reference updates to fix this regression.
>>
>> One downside of this is that the messages can be very verbose, for e.g.
>> in the files backend, when trying to write a non-commit object to a
>> branch, you would see:
>>
>> ! [remote rejected] 3eaec9ccf3a53f168362a6b3fdeb73426fb9813d ->
>> branch (cannot update ref 'refs/heads/branch': trying to write
>> non-commit object 3eaec9ccf3a53f168362a6b3fdeb73426fb9813d to branch
>> 'refs/heads/branch')
>>
>> Here the refname is repeated multiple times due to how error messages
>> are propagated and filled over the code stack. This potentially can be
>> cleaned up in a future commit.
>
> If we are going to have a "potentially cleaned up in the future" state,
> I think I would prefer to see just:
>
> if (details)
> rp_error("%s", details);
>
> here. And then it comes over the stderr sideband, but the actual
> status-table gets the same non-verbose message. That's what happened
> in v2.50.0 and earlier. Later if we want to try to cram more details
> into the machine-readable message we can.
>
> -PeffFair enough, I think that would be a better approach for now, will change.