author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 14 Feb 2010 11:59:59 +0000 (05:59 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 15 Feb 2010 02:23:17 +0000 (18:23 -0800) | ||
commit | 64778d24a93ad455e5883120aef350ede20061c4 | |
tree | 259b89f31782ad41f40b6e7d51f054adbefae9e8 | tree | snapshot |
parent | 9fabb6d7513ab0a264de146d72a8447bc85b5e85 | commit | diff |
Make 'git var GIT_PAGER' always print the configured pager
Scripted commands that want to use git’s configured pager know better
than ‘git var’ does whether stdout is going to be a tty at the
appropriate time. Checking isatty(1) as git_pager() does now won’t
cut it, since the output of git var itself is almost never a terminal.
The symptom is that when used by humans, ‘git var GIT_PAGER’ behaves
as it should, but when used by scripts, it always returns ‘cat’!
So avoid tricks with isatty() and just always print the configured
pager.
This does not fix the callers to check isatty(1) themselves yet.
Nevertheless, this patch alone is enough to fix 'am --interactive'.
Thanks to Sebastian Celis for the report and Jeff King for the
analysis.
Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Scripted commands that want to use git’s configured pager know better
than ‘git var’ does whether stdout is going to be a tty at the
appropriate time. Checking isatty(1) as git_pager() does now won’t
cut it, since the output of git var itself is almost never a terminal.
The symptom is that when used by humans, ‘git var GIT_PAGER’ behaves
as it should, but when used by scripts, it always returns ‘cat’!
So avoid tricks with isatty() and just always print the configured
pager.
This does not fix the callers to check isatty(1) themselves yet.
Nevertheless, this patch alone is enough to fix 'am --interactive'.
Thanks to Sebastian Celis for the report and Jeff King for the
analysis.
Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-var.c | diff | blob | history | |
cache.h | diff | blob | history | |
pager.c | diff | blob | history |