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 26, 2014, 09:26 UTC
Message-ID
<20140226092610.GB32537@sigill.intra.peff.net>
In-Reply-To
<CAHd499BDBgaAZFkoc=S9i9hG=NifAmqhaW86fqgkzjShZd07ww@mail.gmail.com>
On Mon, Feb 24, 2014 at 01:34:34PM -0600, Robert Dailey wrote:
Show 6 quoted lines
> So I set GIT_PAGER to 'echo custom pager' as you instructed, and I
> noticed that wasn't being printed when I ran my git log alias. So what
> I did after that was set GIT_TRACE=1 and here is the output I see
> before my logs start printing:
> [...]
> Does using an alias have something to do with this?

The aliases shouldn't matter (and I constructed a scenario like the one you showed and it starts the pager for me on Linux). It's more like git is deciding not to show a pager at all (e.g., it thinks your stdout is not a tty). Does running:

  git log
not use a pager, but:
  git -p log

does? In that case, I think that your stdout is not a tty for some reason.

If that is the case, try:
  git -p lg

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).

-Peff
---
diff --git a/cache.h b/cache.h
index dc040fb..ecc410e 100644
--- a/cache.h
+++ b/cache.h
@@ -1238,6 +1238,7 @@ static inline ssize_t write_str_in_full(int fd, const char *str)
 
 /* pager.c */
 extern void setup_pager(void);
+extern void setup_pager_with_options(int stdout_is_tty);
 extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
diff --git a/git.c b/git.c
index 7cf2953..ad54891 100644
--- a/git.c
+++ b/git.c
@@ -27,7 +27,7 @@ static void commit_pager_choice(void) {
 		setenv("GIT_PAGER", "cat", 1);
 		break;
 	case 1:
-		setup_pager();
+		setup_pager_with_options(1);
 		break;
 	default:
 		break;
diff --git a/pager.c b/pager.c
index 0cc75a8..b28125d 100644
--- a/pager.c
+++ b/pager.c
@@ -62,7 +62,12 @@ const char *git_pager(int stdout_is_tty)
 
 void setup_pager(void)
 {
-	const char *pager = git_pager(isatty(1));
+	setup_pager_with_options(isatty(1));
+}
+
+void setup_pager_with_options(int stdout_is_tty)
+{
+	const char *pager = git_pager(stdout_is_tty);
 
 	if (!pager || pager_in_use())
 		return;
Previous: Robert DaileyNext: Robert Dailey
Message 7 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.