Re: [PATCH 2/3] Allow isatty to be overriden with GIT_FORCE_TTY

2 messages, 2 authors, 2021-07-09 · open the first message on its own page

Re: [PATCH 2/3] Allow isatty to be overriden with GIT_FORCE_TTY

From: Junio C Hamano <hidden>
Date: 2021-07-06 22:03:51

Avishay Matayev [off-list ref] writes:
There are several behaviors where git will not attempt to do an action if a
tty is not present, for example - `git_pager` (pager.c) will instruct git
to not use the GIT_PAGER environment variable if stdout is not a pty.
In general, I am negative on this approach, even though I agree that
the issue you are trying to solve is worth solving.  "Force pretend
that we are talking to a TTY" exposes too much of the internal
logic in the implementation to the end users.

Often we use isatty() as an approximation for "are we being
interactive?", and I wouldn't have as much problem as I have with
the "FORCE_TTY" to an approach to give users a knob to tell us "do
not use your logic to guess---I am telling you that we are
interactive, so behave as such".

Re: [PATCH 2/3] Allow isatty to be overriden with GIT_FORCE_TTY

From: Avishay Matayev <hidden>
Date: 2021-07-09 14:49:46

On Wed, 7 Jul 2021 at 01:03, Junio C Hamano [off-list ref] wrote:
Avishay Matayev [off-list ref] writes:
quoted
There are several behaviors where git will not attempt to do an action if a
tty is not present, for example - `git_pager` (pager.c) will instruct git
to not use the GIT_PAGER environment variable if stdout is not a pty.
In general, I am negative on this approach, even though I agree that
the issue you are trying to solve is worth solving.  "Force pretend
that we are talking to a TTY" exposes too much of the internal
logic in the implementation to the end users.

Often we use isatty() as an approximation for "are we being
interactive?", and I wouldn't have as much problem as I have with
the "FORCE_TTY" to an approach to give users a knob to tell us "do
not use your logic to guess---I am telling you that we are
interactive, so behave as such".
I'm not sure that I understand your view on this patch.
`git_isatty()` does exactly that, it gives the users that knob, doesn't it?

If you don't find the approach in this patch good enough, what exactly
do you suggest?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help