Re: [PATCH] tag: allow idempotent "git tag" without "--force"
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Jul 11, 2025, 20:57 UTC
- Message-ID
- <dt5ruadvr7lmhsbypmb6yili5cookfx5btw4gzfeui7ehxxajv@ziael4udbbcy>
- In-Reply-To
- <xmqqv7nyzgp7.fsf@gitster.g>
On 25/07/11 12:10PM, Junio C Hamano wrote:
Show 6 quoted lines
> When "git tag T O" is told to create a tag pointing at an object O > without the "--force" option, it refuses with "tag T already exists", > even when T points at O (which makes it a no-op). > > Let's allow this "idempotent" case by special casing and making it > truly a no-op.
Not necessarily a strong argument against, but I could maybe see a user only wanting to perform some followup operation if a tag is _actually_ created. For example push the newly created tag:
git tag T O && git push --tags
To me atleast, the feedback of knowing whether tag was created seems a bit more interesting. I also don't feel super strongly though.
-Justin