Thread (11 messages) flat view 11 messages, 3 authors, 2016-06-15

Re: Cygwin + git log = no pager!

From: Jeff King <hidden>
Date: 2016-06-15 23:00:01
Subsystem: the rest · Maintainer: Linus Torvalds

On Wed, Feb 26, 2014 at 09:54:39AM -0600, Robert Dailey wrote:
quoted
That _should_ turn on the pager, but I think it does not due to a bug
with setup_pager and aliases. Something like the patch below would make
it work (but if you are having to use "-p" manually, there is something
to fix in your cygwin environment, which does not think you are on a
terminal).
I have tried `git -p log` and `git log` and neither use the pager.
I thought Git's behavior was a bug, but it seems to be the intended
effect that "-p" is just "cancel --no-pager" and not "turn on the pager,
even if stdout is not a tty".

So the patch I sent is not something we would want to apply, but it
might help debugging your situation (if my hunch is right that isatty()
is returning false, then "git -p log" would work with it). Or perhaps a
simpler way to check that is just:
diff --git a/pager.c b/pager.c
index 0cc75a8..6d870ac 100644
--- a/pager.c
+++ b/pager.c
@@ -41,8 +41,10 @@ const char *git_pager(int stdout_is_tty)
 {
 	const char *pager;
 
-	if (!stdout_is_tty)
+	if (!stdout_is_tty) {
+		warning("disabling pager, stdout is not a tty");
 		return NULL;
+	}
 
 	pager = getenv("GIT_PAGER");
 	if (!pager) {
Should I apply the provided patch to the Git for Windows master
branch? Also I'm not sure if there is a convenient way to apply a
patch via email, so should I copy & paste it to a file & then apply
the file?
The usual way is to save the patch to an mbox, then use "git am" to
apply it. Most Unix-y mail clients have mbox support, but I suspect many
Windows ones do not.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help