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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx/

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux