Skip to content

Commit 551d535

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7e07d5 commit 551d535

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

t/t7006-pager.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,19 @@ test_GIT_PAGER_overrides expect_success test_must_fail 'git -p request-pull'
378378
test_default_pager expect_success test_must_fail 'git -p'
379379
test_PAGER_overrides expect_success test_must_fail 'git -p'
380380
test_local_config_ignored expect_failure test_must_fail 'git -p'
381-
test_no_local_config_subdir expect_success test_must_fail 'git -p'
382381
test_GIT_PAGER_overrides expect_success test_must_fail 'git -p'
383382

383+
test_expect_failure TTY 'core.pager in repo config works and retains cwd' '
384+
sane_unset GIT_PAGER &&
385+
test_config core.pager "cat >cwd-retained" &&
386+
(
387+
cd sub &&
388+
rm -f cwd-retained &&
389+
test_terminal git -p rev-parse HEAD &&
390+
test_path_is_file cwd-retained
391+
)
392+
'
393+
384394
test_doesnt_paginate expect_failure test_must_fail 'git -p nonsense'
385395

386396
test_pager_choices 'git shortlog'

0 commit comments

Comments
 (0)