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

Re: [PATCH v1 1/8] compat/terminal: let prompt accept input from pipe

From
Jeff King <peff@peff.net>
Date
May 10, 2021, 21:32 UTC
Message-ID
<YJmmXZdwSoR+vxjw@coredump.intra.peff.net>
In-Reply-To
<875yzrgr1f.fsf@Inspiron.i-did-not-set--mail-host-address--so-tickle-me>
On Mon, May 10, 2021 at 06:18:36AM +0200, Firmin Martin wrote:
Show 10 quoted lines
> > Looking at the second patch, the motivation here seems to be to use
> > git_prompt() for another run-of-the-mill prompt. But the right answer
> > is: don't do that. In fact, we recently-ish removed a similar case in
> > 97387c8bdd (am: read interactive input from stdin, 2019-05-20) that was
> > likewise causing problems with the test suite.
> 
> I actually inspired myself from the two occurrences of git_prompt in
> builtin/bisect--helper.c introduced in 09535f056b (bisect--helper:
> reimplement `bisect_autostart` shell function in C, 2020-09-24).
> Not sure if they should also be converted to a simple fgets.
Yes, I think they should be switched.

It looks like since my earlier patches to "am" we have grown a git_read_line_interactively() helper. See:

  https://lore.kernel.org/git/pull.755.git.git.1586374380709.gitgitgadget@gmail.com/

They should probably use that (and likewise, it would make sense for git-am to switch to it).

Show 6 quoted lines
> > I think we might consider renaming git_prompt(), or adding an
> > explanatory comment above it.
> 
> I would be happy to do that. A comment along the line of 97387c8bdd (am:
> read interactive input from stdin, 2019-05-20) and a "CAUTION: don't use
> it for regular prompt" would suffice ?

Yeah. You might want to point people at git_read_line_interactively() in the same header file, too.

-Peff
Previous: Firmin MartinNext: Junio C Hamano
Message 7 of 34 in “format-patch: introduce --confirm-overwrite”
  1. 0/8 format-patch: introduce --confirm-overwriteFirmin Martin, May 6, 2021
  2. 1/8 compat/terminal: let prompt accept input from pipeFirmin Martin, May 6, 2021
  3. Junio C HamanoMay 6, 2021
  4. Jeff KingMay 7, 2021
  5. Junio C HamanoMay 7, 2021
  6. Firmin MartinMay 10, 2021
  7. Jeff KingMay 10, 2021
  8. Junio C HamanoMay 11, 2021
  9. Jeff KingMay 11, 2021
  10. Junio C HamanoMay 11, 2021
  11. Jeff KingMay 11, 2021
  12. 2/8 format-patch: confirmation whenever patches existFirmin Martin, May 6, 2021
  13. Junio C HamanoMay 6, 2021
  14. Firmin MartinMay 10, 2021
  15. Junio C HamanoMay 10, 2021
  16. Firmin MartinMay 11, 2021
  17. 3/8 format-patch: add config option confirmOverwriteFirmin Martin, May 6, 2021
  18. 4/8 format-patch: add the option --confirm-overwriteFirmin Martin, May 6, 2021
  19. 5/8 t4014: test patches overwrite confirmationFirmin Martin, May 6, 2021
  20. 6/8 t4014: fix tests overwriting cover letter in silentFirmin Martin, May 6, 2021
  21. 7/8 doc/format-patch: describe --confirm-overwriteFirmin Martin, May 6, 2021
  22. Bagas SanjayaMay 7, 2021
  23. Firmin MartinMay 10, 2021
  24. 8/8 config/format: describe format.confirmOverwriteFirmin Martin, May 6, 2021
  25. Junio C HamanoMay 6, 2021
  26. Firmin MartinMay 11, 2021
  27. Felipe ContrerasMay 7, 2021
  28. Denton LiuMay 7, 2021
  29. Firmin MartinMay 11, 2021
  30. Felipe ContrerasMay 11, 2021
  31. Felipe ContrerasMay 11, 2021
  32. Sergey OrganovMay 7, 2021
  33. Firmin MartinMay 11, 2021
  34. Ævar Arnfjörð BjarmasonMay 10, 2021

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.