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

Re: [PATCH 0/3] tag: keep the message file in case ref transaction fails

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2023, 16:00 UTC
Message-ID
<xmqqo7mjq779.fsf@gitster.g>
In-Reply-To
<20230517093214.GA527234@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> That said, I'm willing to believe that most users wouldn't figure this
> out on their own, and saving TAG_EDITMSG might be more friendly. But one
> other alternative might be to mention the hash of that tag object, and
> possibly give advice on recovering it.
Hmph, then the advice message would suggest "update-ref"?

Ah, no. Because the message may be reused to create a tag with different tagname, which is very likely because one reason for the refusal to update the ref could be that the name was already taken, and that would create a mismatch between tagname and refname.

OK, so ...
Show 17 quoted lines
> It's too bad we do not have "git tag -c" to match "git commit -c", which
> would allow us to say something like:
>
>       A tag object was created, but we failed to update the ref.
>       After correcting any errors, you can recover the original tag
>       message with:
>
>         git tag -c $oid [other options]
>
> (where we'd replace $oid with the hash of the created tag object). The
> best alternatives I could come up with were:
>
>       # this is kind of obscure advice to give somebody, plus
>       # it makes a weird tag if you originally tried to tag "foo/bar"
>       # but then later switch to some other name. The "tag" field
>       # in the object won't match the ref.
>       git update-ref $ref $oid
... I agree that this is not a very good advice to give, and ...
>       # this saves just the message but is horribly complicated
>       git cat-file tag $oid | sed '1,/^$/d' |
>       git tag -F -

... this is a reasonable thing to have in a more user-friendly feature, like your -c above.

> I dunno. There is a certain elegance to telling the user about what
> progress we _did_ make, but if there isn't an easy way to turn that into
> a retry of their command, it may not be all that useful.

Yeah, I am OK with "leaving TAG_EDITMSG behind" and a future "tag -c/-C $another" to coexist.

Previous: Jeff KingNext: Jeff King
Message 22 of 26 in “tag: keep the message file in case ref transaction fails”
  1. 0/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 14, 2023
  2. 1/3 t/t7004-tag: add regression test for existing behaviorKristoffer Haugsbakk, May 14, 2023
  3. Junio C HamanoMay 15, 2023
  4. 2/3 t/t7004-tag: add failing tag message file testKristoffer Haugsbakk, May 14, 2023
  5. Junio C HamanoMay 15, 2023
  6. Junio C HamanoMay 15, 2023
  7. Kristoffer HaugsbakkMay 15, 2023
  8. 3/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 14, 2023
  9. Junio C HamanoMay 15, 2023
  10. 0/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 15, 2023
  11. 1/3 doc: tag: document `TAG_EDITMSG`Kristoffer Haugsbakk, May 15, 2023
  12. Junio C HamanoMay 15, 2023
  13. 2/3 t/t7004-tag: add regression test for successful tag creationKristoffer Haugsbakk, May 15, 2023
  14. 3/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 15, 2023
  15. Junio C HamanoMay 15, 2023
  16. 0/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 16, 2023
  17. 1/3 doc: tag: document `TAG_EDITMSG`Kristoffer Haugsbakk, May 16, 2023
  18. 2/3 t/t7004-tag: add regression test for successful tag creationKristoffer Haugsbakk, May 16, 2023
  19. 3/3 tag: keep the message file in case ref transaction failsKristoffer Haugsbakk, May 16, 2023
  20. Junio C HamanoMay 16, 2023
  21. Jeff KingMay 17, 2023
  22. Junio C HamanoMay 17, 2023
  23. Jeff KingMay 17, 2023
  24. Eric SunshineMay 17, 2023
  25. Kristoffer HaugsbakkMay 17, 2023
  26. Kristoffer HaugsbakkMay 17, 2023

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.