summaryrefslogtreecommitdiff
path: root/t/t7006-pager.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-08-18 15:01:32 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-19 15:52:25 -0700
commit92058e4d3e032714da6d2df5fa1fe2cf612979a5 (patch)
tree04002eec56f5a5c813e9b7e2c8cf686f6dee2c71 /t/t7006-pager.sh
parentc9bfb953489e559d513c1627150aa16f8d42d6c5 (diff)
downloadgit-92058e4d3e032714da6d2df5fa1fe2cf612979a5.tar.gz
support pager.* for external commands
Without this patch, any commands that are not builtin would not respect pager.* config. For example: git config pager.stash false git stash list would still use a pager. With this patch, pager.stash now has an effect. If it is not specified, we will still fall back to pager.log when we invoke "log" from "stash list". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7006-pager.sh')
-rwxr-xr-xt/t7006-pager.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 458233693b..320e1d1dbe 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -450,4 +450,40 @@ test_expect_success TTY 'command-specific pager overridden by environment' '
test_cmp expect actual
'
+test_expect_success 'setup external command' '
+ cat >git-external <<-\EOF &&
+ #!/bin/sh
+ git "$@"
+ EOF
+ chmod +x git-external
+'
+
+test_expect_success TTY 'command-specific pager works for external commands' '
+ sane_unset PAGER GIT_PAGER &&
+ echo "foo:initial" >expect &&
+ >actual &&
+ test_config pager.external "sed s/^/foo:/ >actual" &&
+ test_terminal git --exec-path="`pwd`" external log --format=%s -1 &&
+ test_cmp expect actual
+'
+
+test_expect_success TTY 'sub-commands of externals use their own pager' '
+ sane_unset PAGER GIT_PAGER &&
+ echo "foo:initial" >expect &&
+ >actual &&
+ test_config pager.log "sed s/^/foo:/ >actual" &&
+ test_terminal git --exec-path=. external log --format=%s -1 &&
+ test_cmp expect actual
+'
+
+test_expect_success TTY 'external command pagers override sub-commands' '
+ sane_unset PAGER GIT_PAGER &&
+ >expect &&
+ >actual &&
+ test_config pager.external false &&
+ test_config pager.log "sed s/^/log:/ >actual" &&
+ test_terminal git --exec-path=. external log --format=%s -1 &&
+ test_cmp expect actual
+'
+
test_done