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

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

From
BFBárbara de Castro Fernandes <barbara.fernandes@usp.br>
Date
Apr 11, 2019, 18:20 UTC
Message-ID
<CAJ+V80pY0L7onX600dmSaMuFFnH5n52-3CmnRyDKr-7ZkZ92mA@mail.gmail.com>
In-Reply-To
<20190405222100.GA10787@sigill.intra.peff.net>
Em sex, 5 de abr de 2019 às 19:21, Jeff King <peff@peff.net> escreveu:
Show 36 quoted lines
>
> 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.

This new proposed --amend option, although semantically different, would have a very similar functionality to the already existing -f option. So should we, perhaps, change -f's behavior to treat the tag as a new one, treating the old one as if it never existed (as I think Junio was saying)? By this I mean the command should fail if the user doesn't give a SHA-1 and the previous message wouldn't be preloaded. --amend, on the other hand, would give the user an opportunity to revise the tag by opening, by default, the editor with the pre-existing message unless given the '--no-edit' option, and if not given a SHA-1 it would keep on using the previous one.

Show 11 quoted lines
> 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).
>
> -Peff
Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “Feature request: Add --no-edit to git tag command”
  1. Robert DaileyApr 3, 2019
  2. Jeff KingApr 4, 2019
  3. Taylor BlauApr 4, 2019
  4. Jeff KingApr 4, 2019
  5. Robert DaileyApr 4, 2019
  6. Robert DaileyApr 4, 2019
  7. Jeff KingApr 5, 2019
  8. Bárbara de Castro FernandesApr 11, 2019
  9. Jeff KingApr 11, 2019
  10. Junio C HamanoApr 12, 2019
  11. Jeff KingApr 12, 2019
  12. Junio C HamanoApr 4, 2019
  13. Jeff KingApr 4, 2019

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.