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

Re: Suggestion: error "tag ... already exists" should distinguish between tagging different or same commit:

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 9, 2025, 20:19 UTC
Message-ID
<xmqqqzzspt0i.fsf@gitster.g>
In-Reply-To
<CAE1pOi34+btHyV8GbjpFPcJ+2ixu59ce4eAE=Q7F4JEcuJyXnw@mail.gmail.com>
Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:
Show 7 quoted lines
> Does it really make sense for that first example to fail, though? "git
> tag hello v1.9.5" is an idempotent operation, isn't it? The second
> attempt is a no-op?
>
> If "git tag ..." simply does nothing if the tag already exists (as
> requested) then that would make the OP's issue go away: only the 2nd
> example would fail.

I do not think I personally mind that direction; when I responded, I thought that in the example, 'hello' is initially pointing at something entirely different (perhaps v2.0.0), though.

But it may be tricky to do, though.

It is easy for lightweight tags, but you'd have to fail an attempt to add an annotated and/or signed tag without -f anyway, so you have to be prepared to answer "why does this behave differently with and without -a/-s?".

Previous: Andreas SchwabNext: Hilco Wijbenga
Message 5 of 14 in “Suggestion: error "tag ... already exists" should distinguish between tagging different or same commit:”
  1. M HickfordJun 9, 2025
  2. Junio C HamanoJun 9, 2025
  3. Hilco WijbengaJun 9, 2025
  4. Andreas SchwabJun 9, 2025
  5. Junio C HamanoJun 9, 2025
  6. Hilco WijbengaJun 9, 2025
  7. M HickfordJun 10, 2025
  8. Junio C HamanoJun 10, 2025
  9. Junio C HamanoJul 7, 2025
  10. rsbecker@nexbridge.comJul 7, 2025
  11. Junio C HamanoJul 11, 2025
  12. tag: allow idempotent "git tag" without "--force"Junio C Hamano, Jul 11, 2025
  13. Justin ToblerJul 11, 2025
  14. Junio C HamanoJul 11, 2025

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.