summaryrefslogtreecommitdiff
path: root/t/t7006-pager.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-03-03 17:32:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-03 21:18:02 (GMT)
commit551d535d721839dedc6e376b12f3adeada8542b4 (patch)
tree2f459d23700518c86b4fc71ac56a9032b125f7ea /t/t7006-pager.sh
parente7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7 (diff)
downloadgit-551d535d721839dedc6e376b12f3adeada8542b4.zip
git-551d535d721839dedc6e376b12f3adeada8542b4.tar.gz
git-551d535d721839dedc6e376b12f3adeada8542b4.tar.bz2
t7006: replace dubious test
The idea of the test case "git -p - core.pager is not used from subdirectory" was to verify that the setup_git_directory() function had not been called just to obtain the core.pager setting. However, we are about to fix the early config machinery so that it *does* work, without messing up the global state. Once that is done, the core.pager setting *will* be used, even when running from a subdirectory, and that is a Good Thing. The intention of that test case, however, was to verify that the setup_git_directory() function has not run, because it changes global state such as the current working directory. To keep that spirit, but fix the incorrect assumption, this patch replaces that test case by a new one that verifies that the pager is run in the subdirectory, i.e. that the current working directory has not been changed at the time the pager is configured and launched, even if the `rev-parse` command requires a .git/ directory and *will* change the working directory. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7006-pager.sh')
-rwxr-xr-xt/t7006-pager.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index c8dc665..304ae06 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -378,9 +378,19 @@ test_GIT_PAGER_overrides expect_success test_must_fail 'git -p request-pull'
test_default_pager expect_success test_must_fail 'git -p'
test_PAGER_overrides expect_success test_must_fail 'git -p'
test_local_config_ignored expect_failure test_must_fail 'git -p'
-test_no_local_config_subdir expect_success test_must_fail 'git -p'
test_GIT_PAGER_overrides expect_success test_must_fail 'git -p'
+test_expect_failure TTY 'core.pager in repo config works and retains cwd' '
+ sane_unset GIT_PAGER &&
+ test_config core.pager "cat >cwd-retained" &&
+ (
+ cd sub &&
+ rm -f cwd-retained &&
+ test_terminal git -p rev-parse HEAD &&
+ test_path_is_file cwd-retained
+ )
+'
+
test_doesnt_paginate expect_failure test_must_fail 'git -p nonsense'
test_pager_choices 'git shortlog'