[PATCH 1/9] t7006: GIT_DIR/config should be honored in subdirs of toplevel
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 13, 2010, 02:13 UTC
- Message-ID
- <20100413021355.GA4118@progeny.tock>
- In-Reply-To
- <20100413021153.GA3978@progeny.tock>
When git is passed the --paginate option, starting up a pager requires deciding what pager to start, which requires access to the core.pager configuration.
Unfortunately, the --paginate option is handled before git has a chance to search for a git directory. The effect is that with --paginate and only with --paginate, a repository-local core.pager setting does not take effect [*].
[*] unless the git directory is simply .git in the cwd or GIT_DIR or GIT_CONFIG was set explicitly.
Add a test to demonstrate this counterintuitive behavior.
Noticed while reading over a patch by Nguyễn Thái Ngọc Duy that fixes it.
Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- t/t7006-pager.sh | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh index d9202d5..4f804ed 100755 --- a/t/t7006-pager.sh +++ b/t/t7006-pager.sh @@ -164,6 +164,38 @@ test_expect_success TTY 'core.pager overrides PAGER' ' test -e core.pager_used ' +unset GIT_PAGER +rm -f core.pager_used +rm -fr sub +test_expect_success TTY 'core.pager in subdir' ' + PAGER=wc && + stampname=$(pwd)/core.pager_used && + export PAGER stampname && + git config core.pager "wc > \"\$stampname\"" && + mkdir sub && + ( + cd sub && + test_terminal git log + ) && + test -e "$stampname" +' + +unset GIT_PAGER +rm -f core.pager_used +rm -fr sub +test_expect_failure TTY 'core.pager in subdir with --paginate' ' + PAGER=wc && + stampname=$(pwd)/core.pager_used && + export PAGER stampname && + git config core.pager "wc > \"\$stampname\"" && + mkdir sub && + ( + cd sub && + test_terminal git --paginate log + ) && + test -e "$stampname" +' + rm -f GIT_PAGER_used test_expect_success TTY 'GIT_PAGER overrides core.pager' ' git config core.pager wc &&
-- 1.7.0.4