Subject: Re: [PATCH v2 1/1] replay: make atomic ref updates the default behavior

From: Siddharth Asthana <[email-masked]>
Date: Fri, 3 Oct 2025 03:50:55 +0530

On 02/10/25 15:30, Karthik Nayak wrote:
> Phillip Wood <[email-masked]> writes:
>
>> Hi Siddharth
>>
>> On 27/09/2025 00:08, Siddharth Asthana wrote:
>>> The git replay command currently outputs update commands that must be
>>> piped to git update-ref --stdin to actually update references:
>>>
>>>       git replay --onto main topic1..topic2 | git update-ref --stdin
>>>
>>> This design has significant limitations for server-side operations. The
>>> two-command pipeline creates coordination complexity, provides no atomic
>>> transaction guarantees by default
>> Are you sure that's true? Maybe I'm missing something but my reading of
>> builtin/update-ref.c is that it when "--stdin" is given it starts a ref
>> transaction, reads the commands from stdin and applies them to that
>> transaction and then commits the transaction which will make the updates
>> atomic.
>>
> You're right. Using '--stdin' is atomic by default. You can manually
> handle the transaction's by passing in the 'start', 'prepare', 'commit',
> 'abort' sub-commands in the '--stdin' mode.

Thanks for confirming this Karthik. I will correct the commit message to
accurately represent what update-ref --stdin provides.

> [snip]