summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2016-07-19 03:57:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-28 21:01:55 (GMT)
commit98f917ed421a477e0575c58f801ac25f0e261b9d (patch)
treeaa3aebc79d863ff65ce5353b52d05aed7d68d746 /t
parent9ec26e797781239b36ebccb87c590e5778358007 (diff)
downloadgit-98f917ed421a477e0575c58f801ac25f0e261b9d.zip
git-98f917ed421a477e0575c58f801ac25f0e261b9d.tar.gz
git-98f917ed421a477e0575c58f801ac25f0e261b9d.tar.bz2
difftool: avoid $GIT_DIR and $GIT_WORK_TREE
Environment variables are global and hard to reason about. Use the `--git-dir` and `--work-tree` arguments when invoking `git` instead of relying on the environment. Add a test to ensure that difftool's dir-diff feature works when these variables are present in the environment. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7800-difftool.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 7ce4cd7..cb25480 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -412,6 +412,20 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory' '
)
'
+run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
+ (
+ GIT_DIR=$(pwd)/.git &&
+ export GIT_DIR &&
+ GIT_WORK_TREE=$(pwd) &&
+ export GIT_WORK_TREE &&
+ cd sub &&
+ git difftool --dir-diff $symlinks --extcmd ls \
+ branch -- sub >output &&
+ grep sub output &&
+ ! grep file output
+ )
+'
+
run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
test_when_finished git reset --hard &&
rm file2 &&