threads / bug / 50004

[BUG] git help -a should no use page when in pipe

Subject: [BUG] git help -a should no use page when in pipe

## tl;dr

2 messages between Dec 11, 2018 and Dec 11, 2018.

replies: 1people: 2as markdown or json

许铖· Dec 11, 2018, 06:26 UTC · lore
To whom may concern,

Since git 2.20.0, invoking `git help -a` will cause git using page (e.g. less) to display help message. However, such behaviour is not desirable when `git help -a` is run inside a pipe or invoked by another program.

Step to reproduce the bug:
     git help -a | cat # this freezes the command line prompt.

This bug also causes issues in `hub` when invoking `git <alias>`. More detail can be found at https://github.com/github/hub/issues/1963

I would suggest `git help -a` only invokes page when stdout is a tty.
Thanks for your attention.

Best Regards, Cheng

Junio C Hamano· Dec 11, 2018, 08:52 UTC · re: 许铖 · lore

Re: [BUG] git help -a should no use page when in pipe

许铖 <thexuc@gmail.com> writes:
> Since git 2.20.0, invoking `git help -a` will cause git using page (e.g. less)
> to display help message.
> ...
> I would suggest `git help -a` only invokes page when stdout is a tty.

It already does so for me. "GIT_PAGER=uc git help -a | cat" where "uc" is a custom "pager" that is "tr '[a-z]' '[A-Z]'" does not show things in ucase, but without piping to cat, the output is in ucase as expected. Perhaps there is something different between what we are doing.

FWIW, I am not on Windows or on a Mac.

← back to recent threads