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

Re: Cygwin + git log = no pager!

From
Jeff King <peff@peff.net>
Date
Feb 27, 2014, 06:21 UTC
Message-ID
<20140227062107.GA21000@sigill.intra.peff.net>
In-Reply-To
<CAHd499Co9Amdf_gWnY81dkRa2uDTH0fVM8HSb99VHhrb1AAKhA@mail.gmail.com>
On Wed, Feb 26, 2014 at 09:54:39AM -0600, Robert Dailey wrote:
Show 7 quoted lines
> > 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
Previous: Robert DaileyNext: Chris Packham
Message 10 of 11 in “Cygwin + git log = no pager!”
  1. Robert DaileyFeb 22, 2014
  2. Chris PackhamFeb 22, 2014
  3. Robert DaileyFeb 23, 2014
  4. Chris PackhamFeb 24, 2014
  5. Jeff KingFeb 24, 2014
  6. Robert DaileyFeb 24, 2014
  7. Jeff KingFeb 26, 2014
  8. Robert DaileyFeb 26, 2014
  9. Robert DaileyFeb 26, 2014
  10. Jeff KingFeb 27, 2014
  11. Chris PackhamFeb 27, 2014

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.