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

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

From
Taylor Blau <me@ttaylorr.com>
Date
Apr 4, 2019, 03:26 UTC
Message-ID
<20190404032606.GA39148@Taylors-MBP.hsd1.wa.comcast.net>
In-Reply-To
<20190404015744.GF4409@sigill.intra.peff.net>
Hi Peff,
On Wed, Apr 03, 2019 at 09:57:44PM -0400, Jeff King wrote:
Show 14 quoted lines
> On Wed, Apr 03, 2019 at 09:38:02AM -0500, Robert Dailey wrote:
>
> > Similar to git commit, it would be nice to have a --no-edit option for
> > git tag. Use case is when I force-recreate a tag:
> >
> > $ git tag -af 1.0 123abc
> >
> > An editor will be prompted with the previous annotated tag message. I
> > would like to add --no-edit to instruct it to use any previously
> > provided message and without prompting the editor:
> >
> > $ git tag --no-edit -af 1.0 123abc
>
> Yeah, that sounds like a good idea.
Agreed.

I think that the implement is a little different than "add a --no-edit" flag, though. 'git tag' already has a OPT_BOOL for '--edit', which means that '--no-edit' exists, too.

But, when we look and see how the edit option is passed around, we find that the check whether or not to launch the editor (again, in builtin/tag.c within 'create_tag()') is:

  if (!opt->message_given || opt->use_editor)

So, it's not that we didn't take '--no-edit', it's that we didn't get a _message_, so we'll open the editor to get one (even if '--no-edit' was given).

This makes me think that we should do two things:
  1. Make !opt->message_give && !opt->use_editor an invalid invocation.
     If I (1) didn't give a message but I did (2) give '--no-edit', I'd
     expect a complaint, not an editor window.
  2. Then, do what Robert suggests, which is to "make opt->message_given
     true", by re-using the previous tag's message.
> I think it wouldn't be very hard to implement, either. Maybe a good
> starter project or #leftoverbits for somebody.

Maybe. I think that it's made a little more complicated by the above, but it's certainly doable. Maybe good for GSoC?

> -Peff

Thanks, Taylor

Previous: Jeff KingNext: Jeff King
Message 3 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.