Git development
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: [PATCH] pager: environment variable GIT_PAGER to override PAGER
Date: Mon, 31 Jul 2006 15:27:00 +0200	[thread overview]
Message-ID: <E1G7XnQ-0002bA-Fm@moooo.ath.cx> (raw)
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:
> 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

      reply	other threads:[~2006-07-31 13:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-29 21:28 [PATCH] pager: config variable pager.program Matthias Lederhofer
2006-07-31  0:43 ` Junio C Hamano
2006-07-31 12:14   ` Matthias Lederhofer
2006-07-31 12:56     ` Johannes Schindelin
2006-07-31 13:27       ` Matthias Lederhofer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1G7XnQ-0002bA-Fm@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox