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

Re: [PATCH 1/2] am: add explicit "--retry" option

From
Jeff King <peff@peff.net>
Date
Jun 8, 2024, 11:29 UTC
Message-ID
<20240608112920.GC2966571@coredump.intra.peff.net>
In-Reply-To
<xmqqtti6m2yz.fsf@gitster.g>
On Thu, Jun 06, 2024 at 09:48:52AM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Jeff King <peff@peff.net> writes:
> >
> >> I think even without the test-terminal cleanup, this is a good thing.
> >> Any time there is a heuristic like isatty(), we should have a way for
> >> the user to be more explicit about what they want().
> >
> > I very often do "git am --no-3" to countermand a failed "git am -3"
> > (or vice versa), so I'll be hit very hard with a need to retrain my
> > fingers.  But I'll live ;-)
> 
> Ah, no, this is not about not paying attention to isatty(0), but
> give us an additional way.  I can see how it would help our tests;
> it would be nicer if the feature also has real world use.

Exactly, you can still do "git am -3" as before, and that's what I'd expect everyone to do. It is just about letting you be explicit if you want.

I don't know if it could have real world use or not. In theory if you had a more complex program driving "git am", you'd need this. But in practice, I think the overlap between "people who write GUIs for Git" and "people who think mailing patches is a good idea" is pretty small. Let alone one with advanced features like "try this patch again with --3way". ;)

But I do think as a general rule we should never provide any action _only_ through heuristics like "is stdin a tty". We should let the user be explicit, and use heuristics to guess the right thing when they don't feel like being so.

Show 5 quoted lines
> > "--retry" is a horrible word, in that it makes it sound like it will
> > keep trying to apply the same patch over and over until it applies
> > cleanly or something.  Can't we use "--continue" like everybody else
> > (like "git rebase --continue", etc.), or would that be even more
> > confusing?

There is already "am --continue", but it is not quite the same thing. It will try to commit the resolved tree state and keep going. Whereas with --retry we really are trying the same patch again. So it really is "over and over again", but only once per invocation. ;)

I'm open to a better name if you can come up with one.
-Peff
Previous: Junio C HamanoNext: Phillip Wood
Message 5 of 9 in “dropping stdin support from test-terminal”
  1. 0/2 dropping stdin support from test-terminalJeff King, Jun 6, 2024
  2. 1/2 am: add explicit "--retry" optionJeff King, Jun 6, 2024
  3. Junio C HamanoJun 6, 2024
  4. Junio C HamanoJun 6, 2024
  5. Jeff KingJun 8, 2024
  6. Phillip WoodJun 10, 2024
  7. 2/2 test-terminal: drop stdin handlingJeff King, Jun 6, 2024
  8. Rubén JustoJun 6, 2024
  9. Rubén JustoJun 6, 2024

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.