git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Junio C Hamano
Message 6 of 6 in “set-head: no update without change and better output for --auto”
  1. set-head: no update without change and better output for --autoBence Ferdinandy, Sep 15, 2024
  2. Junio C HamanoSep 16, 2024
  3. Bence FerdinandySep 16, 2024
  4. Bence FerdinandySep 17, 2024
  5. Junio C HamanoSep 17, 2024
  6. Bence FerdinandySep 19, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.