Re: [PATCH v3] set-head: no update without change and better output for --auto
- From
Bence Ferdinandy <bence@ferdinandy.com>
- Date
- Sep 19, 2024, 20:53 UTC
- Message-ID
- <D4AK4USDVP5T.10INJOFE2I8LE@ferdinandy.com>
- In-Reply-To
- <xmqq34lyknqy.fsf@gitster.g>
On Tue Sep 17, 2024 at 22:51, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> > So, as long as we can explain the behaviour to the end-user well, I > do not care too deeply. My impression was that avoiding it by just > taking advantage of the atomicity afforded by create_symref() looked > like a low hanging fruit, but that can be done by somebody who are > curious to see how involved such a change actually is and can be > safely left as a #leftoverbit ;-). > > Thanks.
Now that I've poked around a bit (cf. https://lore.kernel.org/git/20240919121335.298856-2-bence@ferdinandy.com/T/#u) that fruit does seem to hang lower :)
My idea is the following: Add a new member to the ref_update struct that records the value of the ref _before_ the update transaction (in the files-backend), that can then be accessed post transaction_commit in refs_update_symref. If we want to pass this info up to the caller of refs_update_symref then I guess the only option is to pass an extra buf where we can write this, or if we're fine with update_symref itself doing the printing we probably need a bool to turn this on/off.
My PoC seems to work and pass tests, although judging from previous interactions I'm probably overlooking a couple of edge cases.
Does this seem reasonable?
Best, Bence