Thread (31 messages) 31 messages, 6 authors, 2021-09-13

Lifecycle

  1. Posted Ævar Arnfjörð Bjarmason <avarab@gmail.com>

[PATCH v2 1/7] git-sh-setup: remove unused git_pager() function

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-09-06 07:05:31
Subsystem: the rest · Maintainer: Linus Torvalds

Remove the git_pager() function last referenced by non-test code in
49eb8d39c78 (Remove contrib/examples/*, 2018-03-25).

We can also remove the test for this added in 995bc22d7f8 (pager: move
pager-specific setup into the build, 2016-08-04), the test that
actually matters is the one added in e54c1f2d253 (pager: set LV=-c
alongside LESS=FRSX, 2014-01-06) just above the removed test.

I.e. we don't care if the "LESS" and "LV" variables are set by
git-sh-setup anymore, no built-in uses them, we do care that pager.c
sets them, which we still test for.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 git-sh-setup.sh  | 16 ----------------
 t/t7006-pager.sh | 13 -------------
 2 files changed, 29 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 10d97641856..7ee4b0edff5 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -157,22 +157,6 @@ git_editor() {
 	eval "$GIT_EDITOR" '"$@"'
 }
 
-git_pager() {
-	if test -t 1
-	then
-		GIT_PAGER=$(git var GIT_PAGER)
-	else
-		GIT_PAGER=cat
-	fi
-	for vardef in @@PAGER_ENV@@
-	do
-		var=${vardef%%=*}
-		eval ": \"\${$vardef}\" && export $var"
-	done
-
-	eval "$GIT_PAGER" '"$@"'
-}
-
 sane_grep () {
 	GREP_OPTIONS= LC_ALL=C grep @@SANE_TEXT_GREP@@ "$@"
 }
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 0e7cf75435e..08f712a4497 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -49,19 +49,6 @@ test_expect_success TTY 'LESS and LV envvars are set for pagination' '
 	grep ^LV= pager-env.out
 '
 
-test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '
-	(
-		sane_unset LESS LV &&
-		PAGER="env >pager-env.out; wc" &&
-		export PAGER &&
-		PATH="$(git --exec-path):$PATH" &&
-		export PATH &&
-		test_terminal sh -c ". git-sh-setup && git_pager"
-	) &&
-	grep ^LESS= pager-env.out &&
-	grep ^LV= pager-env.out
-'
-
 test_expect_success TTY 'some commands do not use a pager' '
 	rm -f paginated.out &&
 	test_terminal git rev-list HEAD &&
-- 
2.33.0.821.gfd4106eadbd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help