Skip to content

Commit

Permalink
pager: environment variable GIT_PAGER to override PAGER
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Matthias Lederhofer authored and Junio C Hamano committed Jul 31, 2006
1 parent aa086eb commit c27d205
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ 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"))
Expand Down

0 comments on commit c27d205

Please sign in to comment.