summaryrefslogtreecommitdiff
path: root/t/t7006-pager.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-06-14 11:35:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-15 19:31:43 (GMT)
commit3f9c5dfb7118256747de5efbaa4b5cd3f0e02331 (patch)
tree26effeacc339fa7c6526d1f1f5a293e9fbf772cf /t/t7006-pager.sh
parente4feff4898f4705cc8df50e3dc152ed45ef06db6 (diff)
downloadgit-3f9c5dfb7118256747de5efbaa4b5cd3f0e02331.zip
git-3f9c5dfb7118256747de5efbaa4b5cd3f0e02331.tar.gz
git-3f9c5dfb7118256747de5efbaa4b5cd3f0e02331.tar.bz2
t7006: demonstrate a problem with aliases in subdirectories
When expanding aliases, the git_dir is set during the alias expansion (by virtue of running setup_git_directory_gently()). This git_dir may be relative to the current working directory, and indeed often is simply ".git/". When the alias expands to a shell command, we restore the original working directory, though, yet we do not reset git_dir. As a consequence, subsequent read_early_config() runs will mistake the git_dir to be populated properly and not find the correct config. Demonstrate this problem by adding a test case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7006-pager.sh')
-rwxr-xr-xt/t7006-pager.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 4f3794d..83881ec 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -391,6 +391,17 @@ test_expect_success TTY 'core.pager in repo config works and retains cwd' '
)
'
+test_expect_failure TTY 'core.pager is found via alias in subdirectory' '
+ sane_unset GIT_PAGER &&
+ test_config core.pager "cat >via-alias" &&
+ (
+ cd sub &&
+ rm -f via-alias &&
+ test_terminal git -c alias.r="-p rev-parse" r HEAD &&
+ test_path_is_file via-alias
+ )
+'
+
test_doesnt_paginate expect_failure test_must_fail 'git -p nonsense'
test_pager_choices 'git shortlog'