summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cb6009)
raw | patch | inline | side by side (parent: 2cb6009)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 6 Aug 2010 03:15:09 +0000 (22:15 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 16 Aug 2010 02:57:41 +0000 (19:57 -0700) |
For the pager choice (and the choice to paginate) to reflect the
current repository configuration, the repository needs to be
located first.
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>
current repository configuration, the repository needs to be
located first.
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/config.c | patch | blob | history | |
git.c | patch | blob | history | |
t/t7006-pager.sh | patch | blob | history |
diff --git a/builtin/config.c b/builtin/config.c
index f3d1660d023f7893373436617a9f729ce1d60f4d..3f8ef91dfca3201a0f66fbc69bdcc4d39f9d1339 100644 (file)
--- a/builtin/config.c
+++ b/builtin/config.c
return get_colorbool_found ? 0 : 1;
}
-int cmd_config(int argc, const char **argv, const char *unused_prefix)
+int cmd_config(int argc, const char **argv, const char *prefix)
{
- int nongit;
+ int nongit = !startup_info->have_repository;
char *value;
- const char *prefix = setup_git_directory_gently(&nongit);
config_exclusive_filename = getenv(CONFIG_ENVIRONMENT);
index e76b647b61e8dcb9c4f341ce14e2230969ce457c..eaf6e7f87d74d8ee4da20e4dd7448b08367d0fce 100644 (file)
--- a/git.c
+++ b/git.c
{ "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
{ "commit", cmd_commit, RUN_SETUP | NEED_WORK_TREE },
{ "commit-tree", cmd_commit_tree, RUN_SETUP },
- { "config", cmd_config },
+ { "config", cmd_config, RUN_SETUP_GENTLY },
{ "count-objects", cmd_count_objects, RUN_SETUP },
{ "describe", cmd_describe, RUN_SETUP },
{ "diff", cmd_diff },
{ "reflog", cmd_reflog, RUN_SETUP },
{ "remote", cmd_remote, RUN_SETUP },
{ "replace", cmd_replace, RUN_SETUP },
- { "repo-config", cmd_config },
+ { "repo-config", cmd_config, RUN_SETUP_GENTLY },
{ "rerere", cmd_rerere, RUN_SETUP },
{ "reset", cmd_reset, RUN_SETUP },
{ "rev-list", cmd_rev_list, RUN_SETUP },
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 1890c65fa123e40f956d2c12d6bbe2ecfbcc59d8..017565f3329795b9c8cd39b76fa03e2a16bb3067 100755 (executable)
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
! test -e paginated.out
'
+test_expect_success 'git config uses a pager if configured to' '
+ rm -f paginated.out &&
+ git config pager.config true &&
+ test_when_finished "git config --unset pager.config" &&
+ test_terminal git config --list &&
+ test -e paginated.out
+'
+
test_expect_success 'configuration can enable pager (from subdir)' '
rm -f paginated.out &&
mkdir -p subdir &&