From: Jeff King Date: Mon, 10 May 2021 21:32:13 GMT Subject: Re: [PATCH v1 1/8] compat/terminal: let prompt accept input from pipe Message-ID: 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: > > 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). > > 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