Skip to content

Commit 34fd1c9

Browse files
Linus TorvaldsJunio C Hamano
authored andcommitted
git-log produces no output
When $PAGER is set to 'less -i', we used to fail because we assumed the $PAGER is a command and simply exec'ed it. Try exec first, and then run it through shell if it fails. This allows even funkier PAGERs like these ;-): PAGER='sed -e "s/^/`date`: /" | more' PAGER='contrib/colordiff.perl | less -RS' Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 0dec30b commit 34fd1c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pager.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
static void run_pager(const char *pager)
99
{
1010
execlp(pager, pager, NULL);
11+
execl("/bin/sh", "sh", "-c", pager, NULL);
1112
}
1213

1314
void setup_pager(void)
@@ -47,5 +48,6 @@ void setup_pager(void)
4748

4849
setenv("LESS", "-S", 0);
4950
run_pager(pager);
51+
die("unable to execute pager '%s'", pager);
5052
exit(255);
5153
}

0 commit comments

Comments
 (0)