git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 19, 2016, 21:06 UTC
Message-ID
<xmqqvb01e3s4.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqy44xfq3n.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> 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
Previous: Junio C HamanoNext: David Aguilar
Message 4 of 8 in “difftool: fix argument handling in subdirs”
  1. 1/3 difftool: fix argument handling in subdirsDavid Aguilar, Jul 19, 2016
  2. 2/3 difftool: avoid $GIT_DIR and $GIT_WORK_TREEDavid Aguilar, Jul 19, 2016
  3. Junio C HamanoJul 19, 2016
  4. Junio C HamanoJul 19, 2016
  5. David AguilarJul 20, 2016
  6. 3/3 difftool: use Git::* functions instead of passing around stateDavid Aguilar, Jul 19, 2016
  7. Junio C HamanoJul 19, 2016
  8. Junio C HamanoJul 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.