Subject: Re: [PATCH 2/2] prompt.c: add and use a GIT_TEST_TERMINAL_PROMPT=true

From: Junio C Hamano <[email-masked]>
Date: Wed, 03 Nov 2021 10:42:14 -0700

Jeff King <[email-masked]> writes:

> Basically, I think I just disagree with this paragraph entirely. Moving
> to stdin in the commits you referenced was done to help testing, but I
> also think it's just a more flexible direction overall.

It is OK, and it is more convenient for writing test scripts, to
take interactive input from the standard input stream, if the
command does not use the standard input for other purposes.

"git am -i <mbox" cannot take prompted input via the standard input,
but "git am -i mbox" is an easy workaround, for example.

Commands that are designed to be used in the downstream of a pipe
(e.g. "git rev-list ... | git pack-objects") cannot easily use such
a workaround, so they may still need to open and interact with
/dev/tty if they want to do an interactive input, though [*].

[Footnote]

* "pack-objects" is an excellent example of a command that takes its
  primary input from the standard input, but is a horrible example
  otherwise, because it probably would not make sense for it to take
  any prompted input.