summary refs log tree commit diff
path: root/pager.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-01-13 11:33:34 -0800
committerJunio C Hamano <gitster@pobox.com>2014-01-13 11:33:35 -0800
commit9fac0777e16b6e342f7c84fb7059d6fca52505d2 (patch)
treee1a588d94b3f9727ef0586946d241798a6263551 /pager.c
parent0a8cb0355589cd4058be8b810a9fc608ef9b9a6c (diff)
parente54c1f2d2533c5406abeb8e3e0cf78c68ca9c21e (diff)
Merge branch 'jn/pager-lv-default-env'
Just like we give a reasonable default for "less" via the LESS
environment variable, specify a reasonable default for "lv" via the
"LV" environment variable when spawning the pager.

* jn/pager-lv-default-env:
  pager: set LV=-c alongside LESS=FRSX
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pager.c b/pager.c
index 345b0bc4b5..0cc75a8eee 100644
--- a/pager.c
+++ b/pager.c
@@ -80,8 +80,15 @@ void setup_pager(void)
 	pager_process.use_shell = 1;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-	if (!getenv("LESS")) {
-		static const char *env[] = { "LESS=FRSX", NULL };
+	if (!getenv("LESS") || !getenv("LV")) {
+		static const char *env[3];
+		int i = 0;
+
+		if (!getenv("LESS"))
+			env[i++] = "LESS=FRSX";
+		if (!getenv("LV"))
+			env[i++] = "LV=-c";
+		env[i] = NULL;
 		pager_process.env = env;
 	}
 	if (start_command(&pager_process))