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

Re: [PATCH v2] branch: do not fail a no-op --edit-desc

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 30, 2022, 18:13 UTC
Message-ID
<xmqqill4k9wr.fsf@gitster.g>
In-Reply-To
<220930.861qrsvj12.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 6 quoted lines
>> Ah, OK, so in short, _gently() is still unusable to use for that.  I
>> guess it means that the approach taken by v1 would be a better
>> solution, then.
>
> As you noted it's got a TOCTOU instead, so we might wipe away good
> config entirely.
I do not think that is the case.

What you have in mind is probably something entirely different. If you open two windows, start "edit description" in both, write a description in one of them, then write a different description in another, depending on the order you save the buffer and cause the "git branch --edit-desc" that invoked the editor to use the edited result, the description written in the editor that was later closed will win, instead of telling you "you started from state X and you want to update to state Y, but in the meantime somebody else made it state Z, so I won't overwrite it with state Y". But that has always been with us, IIUC.

The only "funny" thing the change makes it do is leave the good config as-is, if the user starts without an existing branch description and exits with an empty edit buffer, instead of removing the description written in the other window in the meantime. That is quite far from wiping away good config entirely.

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 12 of 13 in “branch: do not fail a no-op --edit-desc”
  1. branch: do not fail a no-op --edit-descJunio C Hamano, Sep 28, 2022
  2. Rubén JustoSep 28, 2022
  3. Junio C HamanoSep 28, 2022
  4. Rubén JustoSep 29, 2022
  5. Junio C HamanoSep 29, 2022
  6. Rubén JustoSep 30, 2022
  7. Rubén JustoOct 1, 2022
  8. branch: do not fail a no-op --edit-descJunio C Hamano, Sep 30, 2022
  9. Ævar Arnfjörð BjarmasonSep 30, 2022
  10. Junio C HamanoSep 30, 2022
  11. Ævar Arnfjörð BjarmasonSep 30, 2022
  12. Junio C HamanoSep 30, 2022
  13. branch: do not fail a no-op --edit-descJunio C Hamano, Sep 30, 2022

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.