summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c9bfb95)
raw | patch | inline | side by side (parent: c9bfb95)
author | Jeff King <peff@peff.net> | |
Thu, 18 Aug 2011 22:01:32 +0000 (15:01 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 19 Aug 2011 22:52:25 +0000 (15:52 -0700) |
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>
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>
git.c | patch | blob | history | |
t/t7006-pager.sh | patch | blob | history |
index 89721d420a09bfc8eb6a2d4010f86f5685cfd255..bb5205e4dd1dfcacc9a02cb53b48d7b7548391c2 100644 (file)
--- a/git.c
+++ b/git.c
const char *tmp;
int status;
+ if (use_pager == -1)
+ use_pager = check_pager_config(argv[0]);
commit_pager_choice();
strbuf_addf(&cmd, "git-%s", argv[0]);
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 458233693bde83ddbd5c9264cf8f9d31401668bb..320e1d1dbe62c81e29186d7a32b73447d2f998b8 100755 (executable)
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
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