Web lists-archives.com

Re: Feature request: Add --no-edit to git tag command

On Thu, Apr 04, 2019 at 08:56:16AM -0500, Robert Dailey wrote:

> > I was thinking it was just the --no-edit fix. :) Even with the "--amend"
> > thing, though, it's probably a little light for a 3-month-long GSoC
> > project. :)
> I apologize for the confusion. I'm not fully aware of any per-option
> philosophies in Git, so I may be unaware of the misunderstanding my
> request is causing. Let me attempt to clarify.

I think most of the confusion was just bad reading on my part. :)

> My goal as a user is to correct a tag. If I point a tag at the wrong
> commit, I simply want to move that tag to point to another commit. At
> the moment, the only way I know to do this is the -f option, which I
> just treat as a "move" for the tag. I realize that may not be its
> intent in the implementation, but from a user perspective that's the
> end result I get.
> So if I treat -f as a "move this tag", I also want to say "reuse the
> existing commit message". So again, in my mind, that means -f
> --no-edit. Which means "I'm moving this tag and I want to keep the
> previous commit message".
> I hope this makes more sense. If getting this means not using -f or
> --no-edit at all, and is instead a whole different set of options, I'm
> OK with that as long as the end result is achievable. It's impossible
> to write a script to "move" (-f) a bunch of annotated tags without an
> editor prompting me on each one. So this "--no-edit" addition would
> assist in automation, and also making sure that we simply want to
> correct a tag, but not alter the message.

Yeah, I think what you want to do is perfectly reasonable. The only
reason not to use "-f" is because it already means other things, and we
don't want to overload it.  Calling it "--amend" would make perfect
sense (and then fixing "--no-edit" so it lets you avoid opening the
editor). So I think there are two bits of work:

  1. Add an "--amend" option, which allows overwriting an existing tag
     and pre-populates the message with the existing tag's message.

  2. Make --no-edit work like the patch I showed earlier (assuming that
     your --amend still opens an editor by default).