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
M Hickford <mirth.hickford@gmail.com>
Date
Jun 10, 2025, 07:00 UTC
Message-ID
<CAGJzqskj803dUcEuV+P-yuWdT0tiaidb7h3YxQSCgYHWgBfaWA@mail.gmail.com>
In-Reply-To
<xmqqcybcrc2u.fsf@gitster.g>
On Mon, 9 Jun 2025 at 19:42, Junio C Hamano <gitster@pobox.com> wrote:
Show 37 quoted lines
>
> M Hickford <mirth.hickford@gmail.com> writes:
>
> > Hi. Presently, the error "tag ... already exists" doesn't distinguish
> > between tagging the same commit or a different commit:
> >
> >      >git tag hello v1.9.5
> >
> >      >git tag hello v1.9.5
> >      fatal: tag 'hello' already exists
> >
> >      >git tag hello v2.0.0
> >      fatal: tag 'hello' already exists
> >
> > To inform the user, it would be nice to distinguish these cases, perhaps:
> >
> >      >git tag hello v1.9.5
> >      fatal: tag 'hello' already exists pointing at
> > d4e6038a068d0aecd5ec28c83afbfc6d4903092f
> >
> >      >git tag hello v2.0.0
> >      fatal: tag 'hello' already exists but points at
> > 18a07354e33f86c8349ffdc300d9087876658264
> >
> > The second error is typically more concerning than the first.
> >
> > What do you think?
>
> Not interested.  When the user gets that "fatal" message, the
> existing tag did not get modified, so they can just do whatever
> check they want (like "git range-diff v1.9.5...hello") themselves.
>
> Besides, in the above examples, is d4e6038a something the user
> immediately recognises as the same as v1.9.5 or the object existing
> v1.9.5 tag points at?  I somehow doubt it.  So after getting the
> error, there needs some digging to figure out how v1.9.5 and
> existing hello are related to each other _anyway_, I would think.
Good point. How about just changing the second error message?
>git tag hello v1.9.5
>git tag hello v1.9.5
fatal: tag 'hello' already exists
>git tag hello v2.0.0
fatal: tag 'hello' already exists but points at a different commit
Previous: Hilco WijbengaNext: Junio C Hamano
Message 7 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.