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

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

From
AMAvishay Matayev <me@avishay.dev>
Date
Jul 9, 2021, 14:49 UTC
Message-ID
<CAJ-0Osy2RLiZmi9m=W=rpK6Bh5uXk-psO-BTb18a8COrsQANUw@mail.gmail.com>
In-Reply-To
<xmqqbl7fgkvu.fsf@gitster.g>
On Wed, 7 Jul 2021 at 01:03, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
>
> Avishay Matayev <me@avishay.dev> 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".

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?

Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 13 in “Override isatty with GIT_FORCE_TTY”
  1. 0/3 Override isatty with GIT_FORCE_TTYAvishay Matayev, Jul 6, 2021
  2. 1/3 Change isatty's parameter to a *_FILENO defineAvishay Matayev, Jul 6, 2021
  3. Junio C HamanoJul 6, 2021
  4. Avishay MatayevJul 9, 2021
  5. 2/3 Allow isatty to be overriden with GIT_FORCE_TTYAvishay Matayev, Jul 6, 2021
  6. Junio C HamanoJul 6, 2021
  7. Avishay MatayevJul 9, 2021
  8. Junio C HamanoJul 9, 2021
  9. Avishay MatayevJul 9, 2021
  10. Junio C HamanoJul 9, 2021
  11. Avishay MatayevJul 9, 2021
  12. 3/3 Add tests for GIT_FORCE_TTYAvishay Matayev, Jul 6, 2021
  13. Avishay MatayevJul 30, 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.