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

From: Siddharth Asthana <[email-masked]>
Date: Thu, 9 Oct 2025 02:40:04 +0530

On 09/10/25 02:29, Junio C Hamano wrote:
> Siddharth Asthana <[email-masked]> writes:
>
>> On 04/10/25 02:02, Junio C Hamano wrote:
>>> Elijah Newren <[email-masked]> writes:
>>>
>>>>> For naming, I am thinking either:
>>>>>      - replay.updateRefs (boolean: true = update, false = output-commands)
>>>>>      - replay.defaultOutput (string: "update" | "commands")
>>>>>
>>>>> The boolean feels simpler, but the string might be more extensible if we
>>>>> add other output modes later. Which pattern feels more consistent with
>>>>> existing Git config conventions? Looking at rebase.* they're mostly
>>>>> boolean toggles, but am I missing a better example to follow?
>>>> replay.updateRefs sounds better to me.  defaultOutput with "update"
>>>> doesn't make sense to me.
>>> Yup.  Or "replay.defaultAction = (update-ref | show-comamnds)" if we
>>> anticipate that we might have a third option someday.  That would of
>>> course affect the choice of the command line option.
>>
>> That's interesting. Between:
>> - replay.updateRefs (boolean)
>> - replay.defaultAction (enum string)
>>
>> The enum is more extensible, but do we actually anticipate other modes?
>> Elijah's --format idea from Kristoffer might be a third mode eventually,
>> but that seems far off.
> What do you exactly mean "far off"?  If it won't happen in 2 weeks,
> but it is likely to come in 2 years, then making sure we have smooth
> upgrade paths is still valuable.  Once you start with "do we update
> refs?" boolean, how would you later accomodate the third option?

You are right - I wasn't thinking about the upgrade path properly.

Looking at Kristoffer's post-rewrite hook use case --format support seems
likely within a reasonable timeframe. And you are absolutely right that
starting with a boolean creates an awkward situation: we would end up with
replay.updateRefs (boolean) plus replay.outputFormat (string) or something
similarly messy.

The enum approach is cleaner:

   replay.defaultAction = update-refs | show-commands | format

This keeps one config variable handling all output modes. When --format
gets added, it's just another value, not a new config.

For the command line, I'm thinking --update-refs=<mode> makes the most
sense. It's specific enough to be clear but general enough to handle the
three modes. The slight inconsistency with the config name
(defaultAction vs updateRefs) seems acceptable since the command line is
about *what* to do with refs, while the config is about the broader action.

Does that reasoning make sense?

>
> No matter what you do then, the end result would be an awkward "if
> you want the command to update the refs, set this Boolean to true,
> if you want the command to show what would happen in the output,
> set this _OTHER_ configuration option to this string, or you can set
> this yet another variable to cause this different action to happen."