Re: [PATCH v2 1/1] replay: make atomic ref updates the default behavior
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 8, 2025, 20:59 UTC
- Message-ID
- <xmqq4is9f6tv.fsf@gitster.g>
- In-Reply-To
- <ea7aa170-400c-47fa-b3f0-2623fcbfcaea@gmail.com>
Siddharth Asthana <siddharthasthana31@gmail.com> writes:
Show 25 quoted lines
> On 04/10/25 02:02, Junio C Hamano wrote: >> Elijah Newren <newren@gmail.com> 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?
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."