Subject: Re: [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE

From: Junio C Hamano <[email-masked]>
Date: Tue, 19 Jul 2016 14:06:35 -0700

Junio C Hamano <[email-masked]> writes:

> It is not wrong per-se, but as you are in a subshell, you do not
> have to unset these, I would think.  Not worth a reroll, but unless
> I am overlooking something (in which case please holler) I'm
> inclined to remove these two lines myself while queuing the series.

I propose to squashing the following to 2/3 (and adjusting 3/3 as
needed).  No need to resend if you agree it is a good idea, as it is
part of what I've queued on 'pu'.

Thanks.

 git-difftool.perl   | 2 +-
 t/t7800-difftool.sh | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index bc2267f..c81cbe4 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -88,11 +88,11 @@ sub changed_files
 	my @refreshargs = (
 		@gitargs, 'update-index',
 		'--really-refresh', '-q', '--unmerged');
-	my @diffargs = (@gitargs, 'diff-files', '--name-only', '-z');
 	try {
 		Git::command_oneline(@refreshargs);
 	} catch Git::Error::Command with {};
 
+	my @diffargs = (@gitargs, 'diff-files', '--name-only', '-z');
 	my $line = Git::command_oneline(@diffargs);
 	my @files;
 	if (defined $line) {
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index afdf370..cb25480 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -421,8 +421,6 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
 		cd sub &&
 		git difftool --dir-diff $symlinks --extcmd ls \
 			branch -- sub >output &&
-		sane_unset GIT_WORK_TREE &&
-		sane_unset GIT_DIR &&
 		grep sub output &&
 		! grep file output
 	)
-- 
2.9.2-581-g77f0ffb