summaryrefslogtreecommitdiff
path: root/pager.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-10-30 20:45:34 -0500
committerJunio C Hamano <gitster@pobox.com>2009-11-13 12:20:56 -0800
commita3d023d0a3783612053f2149e784b43befceccad (patch)
treeae3aa82e18230a6c45c451710067c972473a134a /pager.c
parent8f4b576ad14943a7b14cb8937eb321b7bfd91ee7 (diff)
downloadgit-a3d023d0a3783612053f2149e784b43befceccad.tar.gz
Provide a build time default-pager setting
Provide a DEFAULT_PAGER knob so packagers can set the fallback pager to something appropriate during the build. Examples: On (old) solaris systems, /usr/bin/less (typically the first less found) doesn't understand the default arguments (FXRS), which forces users to alter their environment (PATH, GIT_PAGER, LESS, etc) or have a local or global gitconfig before paging works as expected. On Debian systems, by policy packages must fall back to the 'pager' command, so that changing the target of the /usr/bin/pager symlink changes the default pager for all packages at once. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pager.c b/pager.c
index 0b63d99fe7..92c03f654a 100644
--- a/pager.c
+++ b/pager.c
@@ -2,6 +2,10 @@
#include "run-command.h"
#include "sigchain.h"
+#ifndef DEFAULT_PAGER
+#define DEFAULT_PAGER "less"
+#endif
+
/*
* This is split up from the rest of git so that we can do
* something different on Windows.
@@ -60,7 +64,7 @@ const char *git_pager(void)
if (!pager)
pager = getenv("PAGER");
if (!pager)
- pager = "less";
+ pager = DEFAULT_PAGER;
else if (!*pager || !strcmp(pager, "cat"))
pager = NULL;