summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee38dfb)
raw | patch | inline | side by side (parent: ee38dfb)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 6 Aug 2010 03:01:37 +0000 (22:01 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 11 Aug 2010 16:24:01 +0000 (09:24 -0700) |
shortlog already runs a repository search unconditionally;
running such a search earlier is not very risky.
Without this change, the “[pager] shortlog” configuration
is not respected at all: “git shortlog” unconditionally paginates.
The tests are a bit slow. Running the full battery like this
for all built-in commands would be counterproductive; the intent is
rather to test shortlog as a representative example command using
..._gently().
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
running such a search earlier is not very risky.
Without this change, the “[pager] shortlog” configuration
is not respected at all: “git shortlog” unconditionally paginates.
The tests are a bit slow. Running the full battery like this
for all built-in commands would be counterproductive; the intent is
rather to test shortlog as a representative example command using
..._gently().
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/shortlog.c | patch | blob | history | |
git.c | patch | blob | history | |
t/t7006-pager.sh | patch | blob | history |
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 0a9681ba7ece52e751b1b54d53f3e8fb4c19464e..2135b0dde11faa0c501682ed074e0ba96bf28b42 100644 (file)
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
{
static struct shortlog log;
static struct rev_info rev;
- int nongit;
+ int nongit = !startup_info->have_repository;
static const struct option options[] = {
OPT_BOOLEAN('n', "numbered", &log.sort_by_number,
struct parse_opt_ctx_t ctx;
- prefix = setup_git_directory_gently(&nongit);
git_config(git_default_config, NULL);
shortlog_init(&log);
init_revisions(&rev, prefix);
index c1d1ee78fcaecb8ee0959cd7e69c474a0ebd9f1d..3d96c2bcd30cf22f452abcdd44c214d2f2b4d579 100644 (file)
--- a/git.c
+++ b/git.c
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
{ "rm", cmd_rm, RUN_SETUP },
{ "send-pack", cmd_send_pack, RUN_SETUP },
- { "shortlog", cmd_shortlog, USE_PAGER },
+ { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 71d3ceff8f06ad33aee5e48f85e97164df447a59..43b310218ae7a4b17e66f3b5949cf42218da07c8 100755 (executable)
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
test_doesnt_paginate expect_failure test_must_fail 'git -p nonsense'
+test_pager_choices 'git shortlog'
+test_expect_success 'setup: configure shortlog not to paginate' '
+ git config pager.shortlog false
+'
+test_doesnt_paginate expect_success 'git shortlog'
+test_no_local_config_subdir expect_success 'git shortlog'
+test_default_pager expect_success 'git -p shortlog'
+test_core_pager_subdir expect_success 'git -p shortlog'
+
test_done