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

[PATCH] pager: environment variable GIT_PAGER to override PAGER

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Jul 31, 2006, 13:27 UTC
Message-ID
<E1G7XnQ-0002bA-Fm@moooo.ath.cx>
In-Reply-To
<Pine.LNX.4.63.0607311454040.29667@wbgn013.biozentrum.uni-wuerzburg.de>
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 17 quoted lines
> Hi,
> 
> On Mon, 31 Jul 2006, Matthias Lederhofer wrote:
> 
> > Signed-off-by: Matthias Lederhofer <matled@gmx.net>
> 
> The commit message no longer reflects what the patch does ;-)
> 
> > -	const char *pager = getenv("PAGER");
> > +	char *pager;
> 
> You do not need to lose the "const" (it means that you cannot access the 
> memory it points to, but you can change the pointer). Also, you could make 
> a more minimal patch by replacing PAGER by GIT_PAGER here, instead of 
> having this extra line:
> 
> > +	pager = getenv("GIT_PAGER");
Thanks, I should be more careful when correcting a patch with
--amend.
---
 Documentation/git.txt |    3 +++
 pager.c               |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7310a2b..d243883 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -627,6 +627,9 @@ git Diffs
 
 other
 ~~~~~
+'GIT_PAGER'::
+	This environment variable overrides `$PAGER`.
+
 'GIT_TRACE'::
 	If this variable is set git will print `trace:` messages on
 	stderr telling about alias expansion, built-in command
diff --git a/pager.c b/pager.c
index 280f57f..dcb398d 100644
--- a/pager.c
+++ b/pager.c
@@ -15,11 +15,13 @@ void setup_pager(void)
 {
 	pid_t pid;
 	int fd[2];
-	const char *pager = getenv("PAGER");
+	const char *pager = getenv("GIT_PAGER");
 
 	if (!isatty(1))
 		return;
 	if (!pager)
+		pager = getenv("PAGER");
+	if (!pager)
 		pager = "less";
 	else if (!*pager || !strcmp(pager, "cat"))
 		return;
-- 
1.4.2.rc2.g91b7
Previous: Johannes Schindelin
Message 5 of 5 in “pager: config variable pager.program”
  1. pager: config variable pager.programMatthias Lederhofer, Jul 29, 2006
  2. Junio C HamanoJul 31, 2006
  3. pager: config variable pager.programMatthias Lederhofer, Jul 31, 2006
  4. Johannes SchindelinJul 31, 2006
  5. pager: environment variable GIT_PAGER to override PAGERMatthias Lederhofer, Jul 31, 2006

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.