On Sat, Nov 19, 2022 at 04:40:43PM +0400, Konstantin Khomoutov wrote:

[...]
> > git log --graph --all --decorate --pretty=short | git name-rev --stdin | 
> > more
[...]
>  - So, since a command pipelines as implemented in Unix and Windows shells
>    have no way to propagate some information "backwards" from "the rightmost"
>    command to "the leftmost", this problem generally has no solution:
[...]

I mean, when a pipeline like the one you've presented is being executed, only
"the rightmost" command - `more` in this case - has its stdout possibly
connected to a terminal-like device (which, these days, is usually your GUI
terminal emulator), and the command which is to actually generate ANSI
color-controlling sequences in its output is `git log`, and its stdout is
connected to an OS-controlled "pipe" (see the pipe(2) manual page, if
interested), so when `git log` calls something like isatty(3) to fiure out
whether it's connected to a terminal-like device, the check obviously returns
"no", and so with the default settings, `git log` turns its color generation
off.

Well, and there's no way for `more` to somehow communicate the fact "hey, I'm
connected to a terminal!" back to the "producer" command(s). And really, this
would be quite cumbersome to implement, if at all possble to do reliably.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20221119125133.h3s2zxbrvceyxfe4%40carbon.

Reply via email to