git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/3] difftool: fix argument handling in subdirs
@ 2016-07-19  3:57 David Aguilar
  2016-07-19  3:57 ` [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE David Aguilar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David Aguilar @ 2016-07-19  3:57 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

From: John Keeping <john@keeping.me.uk>

When in a subdirectory of a repository, path arguments should be
interpreted relative to the current directory not the root of the
working tree.

The Git::repository object passed into setup_dir_diff() is configured to
handle this correctly but we create a new Git::repository here without
setting the WorkingSubdir argument.  By simply using the existing
repository, path arguments are handled relative to the current
directory.

Reported-by: Bernhard Kirchen <bernhard.kirchen@rwth-aachen.de>
Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: David Aguilar <davvid@gmail.com>
---
This patch is unchanged from John's version but also includes
Reported-by and Acked-by lines.

 git-difftool.perl | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index ebd13ba..c9d3ef8 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -115,16 +115,9 @@ sub setup_dir_diff
 {
 	my ($repo, $workdir, $symlinks) = @_;
 
-	# Run the diff; exit immediately if no diff found
-	# 'Repository' and 'WorkingCopy' must be explicitly set to insure that
-	# if $GIT_DIR and $GIT_WORK_TREE are set in ENV, they are actually used
-	# by Git->repository->command*.
 	my $repo_path = $repo->repo_path();
-	my %repo_args = (Repository => $repo_path, WorkingCopy => $workdir);
-	my $diffrepo = Git->repository(%repo_args);
-
 	my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
-	my $diffrtn = $diffrepo->command_oneline(@gitargs);
+	my $diffrtn = $repo->command_oneline(@gitargs);
 	exit(0) unless defined($diffrtn);
 
 	# Build index info for left and right sides of the diff
@@ -176,12 +169,12 @@ EOF
 
 		if ($lmode eq $symlink_mode) {
 			$symlink{$src_path}{left} =
-				$diffrepo->command_oneline('show', "$lsha1");
+				$repo->command_oneline('show', "$lsha1");
 		}
 
 		if ($rmode eq $symlink_mode) {
 			$symlink{$dst_path}{right} =
-				$diffrepo->command_oneline('show', "$rsha1");
+				$repo->command_oneline('show', "$rsha1");
 		}
 
 		if ($lmode ne $null_mode and $status !~ /^C/) {
-- 
2.9.2.280.g385e27a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE
  2016-07-19  3:57 [PATCH 1/3] difftool: fix argument handling in subdirs David Aguilar
@ 2016-07-19  3:57 ` David Aguilar
  2016-07-19 18:19   ` Junio C Hamano
  2016-07-19  3:57 ` [PATCH 3/3] difftool: use Git::* functions instead of passing around state David Aguilar
  2016-07-19 18:15 ` [PATCH 1/3] difftool: fix argument handling in subdirs Junio C Hamano
  2 siblings, 1 reply; 8+ messages in thread
From: David Aguilar @ 2016-07-19  3:57 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

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>
---
 git-difftool.perl   | 27 ++++++---------------------
 t/t7800-difftool.sh | 16 ++++++++++++++++
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index c9d3ef8..bc2267f 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -83,20 +83,17 @@ sub changed_files
 {
 	my ($repo_path, $index, $worktree) = @_;
 	$ENV{GIT_INDEX_FILE} = $index;
-	$ENV{GIT_WORK_TREE} = $worktree;
-	my $must_unset_git_dir = 0;
-	if (not defined($ENV{GIT_DIR})) {
-		$must_unset_git_dir = 1;
-		$ENV{GIT_DIR} = $repo_path;
-	}
 
-	my @refreshargs = qw/update-index --really-refresh -q --unmerged/;
-	my @gitargs = qw/diff-files --name-only -z/;
+	my @gitargs = ('--git-dir', $repo_path, '--work-tree', $worktree);
+	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 $line = Git::command_oneline(@gitargs);
+	my $line = Git::command_oneline(@diffargs);
 	my @files;
 	if (defined $line) {
 		@files = split('\0', $line);
@@ -105,8 +102,6 @@ sub changed_files
 	}
 
 	delete($ENV{GIT_INDEX_FILE});
-	delete($ENV{GIT_WORK_TREE});
-	delete($ENV{GIT_DIR}) if ($must_unset_git_dir);
 
 	return map { $_ => 1 } @files;
 }
@@ -204,15 +199,6 @@ EOF
 	mkpath($ldir) or exit_cleanup($tmpdir, 1);
 	mkpath($rdir) or exit_cleanup($tmpdir, 1);
 
-	# If $GIT_DIR is not set prior to calling 'git update-index' and
-	# 'git checkout-index', then those commands will fail if difftool
-	# is called from a directory other than the repo root.
-	my $must_unset_git_dir = 0;
-	if (not defined($ENV{GIT_DIR})) {
-		$must_unset_git_dir = 1;
-		$ENV{GIT_DIR} = $repo_path;
-	}
-
 	# Populate the left and right directories based on each index file
 	my ($inpipe, $ctx);
 	$ENV{GIT_INDEX_FILE} = "$tmpdir/lindex";
@@ -241,7 +227,6 @@ EOF
 
 	# If $GIT_DIR was explicitly set just for the update/checkout
 	# commands, then it should be unset before continuing.
-	delete($ENV{GIT_DIR}) if ($must_unset_git_dir);
 	delete($ENV{GIT_INDEX_FILE});
 
 	# Changes in the working tree need special treatment since they are
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 42a2929..fa43c24 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -412,6 +412,22 @@ 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 &&
+		sane_unset GIT_WORK_TREE &&
+		sane_unset GIT_DIR &&
+		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 &&
-- 
2.9.2.280.g385e27a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] difftool: use Git::* functions instead of passing around state
  2016-07-19  3:57 [PATCH 1/3] difftool: fix argument handling in subdirs David Aguilar
  2016-07-19  3:57 ` [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE David Aguilar
@ 2016-07-19  3:57 ` David Aguilar
  2016-07-19 18:29   ` Junio C Hamano
  2016-07-19 18:15 ` [PATCH 1/3] difftool: fix argument handling in subdirs Junio C Hamano
  2 siblings, 1 reply; 8+ messages in thread
From: David Aguilar @ 2016-07-19  3:57 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

Call Git::command() and friends directly wherever possible.
This makes it clear that these operations can be invoked directly
without needing to manage the current directory and related GIT_*
environment variables.

Eliminate find_repository() since we can now use wc_path() and
not worry about side-effects involving environment variables.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-difftool.perl | 54 ++++++++++++++++++++++--------------------------------
 1 file changed, 22 insertions(+), 32 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index bc2267f..a5790d0 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -37,14 +37,6 @@ USAGE
 	exit($exitcode);
 }
 
-sub find_worktree
-{
-	# Git->repository->wc_path() does not honor changes to the working
-	# tree location made by $ENV{GIT_WORK_TREE} or the 'core.worktree'
-	# config variable.
-	return Git::command_oneline('rev-parse', '--show-toplevel');
-}
-
 sub print_tool_help
 {
 	# See the comment at the bottom of file_diff() for the reason behind
@@ -67,14 +59,14 @@ sub exit_cleanup
 
 sub use_wt_file
 {
-	my ($repo, $workdir, $file, $sha1) = @_;
+	my ($workdir, $file, $sha1) = @_;
 	my $null_sha1 = '0' x 40;
 
 	if (-l "$workdir/$file" || ! -e _) {
 		return (0, $null_sha1);
 	}
 
-	my $wt_sha1 = $repo->command_oneline('hash-object', "$workdir/$file");
+	my $wt_sha1 = Git::command_oneline('hash-object', "$workdir/$file");
 	my $use = ($sha1 eq $null_sha1) || ($sha1 eq $wt_sha1);
 	return ($use, $wt_sha1);
 }
@@ -88,11 +80,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) {
@@ -108,11 +100,9 @@ sub changed_files
 
 sub setup_dir_diff
 {
-	my ($repo, $workdir, $symlinks) = @_;
-
-	my $repo_path = $repo->repo_path();
+	my ($workdir, $symlinks) = @_;
 	my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
-	my $diffrtn = $repo->command_oneline(@gitargs);
+	my $diffrtn = Git::command_oneline(@gitargs);
 	exit(0) unless defined($diffrtn);
 
 	# Build index info for left and right sides of the diff
@@ -164,12 +154,12 @@ EOF
 
 		if ($lmode eq $symlink_mode) {
 			$symlink{$src_path}{left} =
-				$repo->command_oneline('show', "$lsha1");
+				Git::command_oneline('show', $lsha1);
 		}
 
 		if ($rmode eq $symlink_mode) {
 			$symlink{$dst_path}{right} =
-				$repo->command_oneline('show', "$rsha1");
+				Git::command_oneline('show', $rsha1);
 		}
 
 		if ($lmode ne $null_mode and $status !~ /^C/) {
@@ -181,8 +171,8 @@ EOF
 			if ($working_tree_dups{$dst_path}++) {
 				next;
 			}
-			my ($use, $wt_sha1) = use_wt_file($repo, $workdir,
-							  $dst_path, $rsha1);
+			my ($use, $wt_sha1) =
+				use_wt_file($workdir, $dst_path, $rsha1);
 			if ($use) {
 				push @working_tree, $dst_path;
 				$wtindex .= "$rmode $wt_sha1\t$dst_path\0";
@@ -203,27 +193,27 @@ EOF
 	my ($inpipe, $ctx);
 	$ENV{GIT_INDEX_FILE} = "$tmpdir/lindex";
 	($inpipe, $ctx) =
-		$repo->command_input_pipe(qw(update-index -z --index-info));
+		Git::command_input_pipe('update-index', '-z', '--index-info');
 	print($inpipe $lindex);
-	$repo->command_close_pipe($inpipe, $ctx);
+	Git::command_close_pipe($inpipe, $ctx);
 
 	my $rc = system('git', 'checkout-index', '--all', "--prefix=$ldir/");
 	exit_cleanup($tmpdir, $rc) if $rc != 0;
 
 	$ENV{GIT_INDEX_FILE} = "$tmpdir/rindex";
 	($inpipe, $ctx) =
-		$repo->command_input_pipe(qw(update-index -z --index-info));
+		Git::command_input_pipe('update-index', '-z', '--index-info');
 	print($inpipe $rindex);
-	$repo->command_close_pipe($inpipe, $ctx);
+	Git::command_close_pipe($inpipe, $ctx);
 
 	$rc = system('git', 'checkout-index', '--all', "--prefix=$rdir/");
 	exit_cleanup($tmpdir, $rc) if $rc != 0;
 
 	$ENV{GIT_INDEX_FILE} = "$tmpdir/wtindex";
 	($inpipe, $ctx) =
-		$repo->command_input_pipe(qw(update-index --info-only -z --index-info));
+		Git::command_input_pipe('update-index', '--info-only', '-z', '--index-info');
 	print($inpipe $wtindex);
-	$repo->command_close_pipe($inpipe, $ctx);
+	Git::command_close_pipe($inpipe, $ctx);
 
 	# If $GIT_DIR was explicitly set just for the update/checkout
 	# commands, then it should be unset before continuing.
@@ -393,9 +383,9 @@ sub dir_diff
 	my $rc;
 	my $error = 0;
 	my $repo = Git->repository();
-	my $workdir = find_worktree();
-	my ($a, $b, $tmpdir, @worktree) =
-		setup_dir_diff($repo, $workdir, $symlinks);
+	my $repo_path = $repo->repo_path();
+	my $workdir = $repo->wc_path();
+	my ($a, $b, $tmpdir, @worktree) = setup_dir_diff($workdir, $symlinks);
 
 	if (defined($extcmd)) {
 		$rc = system($extcmd, $a, $b);
@@ -421,10 +411,10 @@ sub dir_diff
 		next if ! -f "$b/$file";
 
 		if (!$indices_loaded) {
-			%wt_modified = changed_files($repo->repo_path(),
-				"$tmpdir/wtindex", "$workdir");
-			%tmp_modified = changed_files($repo->repo_path(),
-				"$tmpdir/wtindex", "$b");
+			%wt_modified = changed_files(
+				$repo_path, "$tmpdir/wtindex", $workdir);
+			%tmp_modified = changed_files(
+				$repo_path, "$tmpdir/wtindex", $b);
 			$indices_loaded = 1;
 		}
 
-- 
2.9.2.280.g385e27a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] difftool: fix argument handling in subdirs
  2016-07-19  3:57 [PATCH 1/3] difftool: fix argument handling in subdirs David Aguilar
  2016-07-19  3:57 ` [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE David Aguilar
  2016-07-19  3:57 ` [PATCH 3/3] difftool: use Git::* functions instead of passing around state David Aguilar
@ 2016-07-19 18:15 ` Junio C Hamano
  2 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2016-07-19 18:15 UTC (permalink / raw)
  To: David Aguilar
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

David Aguilar <davvid@gmail.com> writes:

> From: John Keeping <john@keeping.me.uk>
>
> When in a subdirectory of a repository, path arguments should be
> ...
> directory.
>
> Reported-by: Bernhard Kirchen <bernhard.kirchen@rwth-aachen.de>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> Acked-by: David Aguilar <davvid@gmail.com>
> ---
> This patch is unchanged from John's version but also includes
> Reported-by and Acked-by lines.

Thanks; will replace.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE
  2016-07-19  3:57 ` [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE David Aguilar
@ 2016-07-19 18:19   ` Junio C Hamano
  2016-07-19 21:06     ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2016-07-19 18:19 UTC (permalink / raw)
  To: David Aguilar
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

David Aguilar <davvid@gmail.com> writes:

> 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.

Yes, that is a very good idea.  I was wondering what would happen
with that "must-not-unset-nor-smudge if it already is set" thing.

> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index 42a2929..fa43c24 100755
> --- a/t/t7800-difftool.sh
> +++ b/t/t7800-difftool.sh
> @@ -412,6 +412,22 @@ 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 &&
> +		sane_unset GIT_WORK_TREE &&
> +		sane_unset GIT_DIR &&

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.

Thanks.

> +		grep sub output &&
> +		! grep file output
> +	)
> +'

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] difftool: use Git::* functions instead of passing around state
  2016-07-19  3:57 ` [PATCH 3/3] difftool: use Git::* functions instead of passing around state David Aguilar
@ 2016-07-19 18:29   ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2016-07-19 18:29 UTC (permalink / raw)
  To: David Aguilar
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

David Aguilar <davvid@gmail.com> writes:

> Call Git::command() and friends directly wherever possible.
> This makes it clear that these operations can be invoked directly
> without needing to manage the current directory and related GIT_*
> environment variables.

Good.

> @@ -88,11 +80,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) {

This hunk looks like "oops, the @diffargs variable logically belongs
here, not there", correcting an mistake in an earlier step.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE
  2016-07-19 18:19   ` Junio C Hamano
@ 2016-07-19 21:06     ` Junio C Hamano
  2016-07-20 22:25       ` David Aguilar
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2016-07-19 21:06 UTC (permalink / raw)
  To: David Aguilar
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE
  2016-07-19 21:06     ` Junio C Hamano
@ 2016-07-20 22:25       ` David Aguilar
  0 siblings, 0 replies; 8+ messages in thread
From: David Aguilar @ 2016-07-20 22:25 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: John Keeping, Bernhard Kirchen, Tim Henigan, Git Mailing List

On Tue, Jul 19, 2016 at 02:06:35PM -0700, Junio C Hamano wrote:
> 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.


I had originally meant to squash that in but it slipped through.
It looks great.

Thank you!


>  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
> 

-- 
David

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-07-20 22:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19  3:57 [PATCH 1/3] difftool: fix argument handling in subdirs David Aguilar
2016-07-19  3:57 ` [PATCH 2/3] difftool: avoid $GIT_DIR and $GIT_WORK_TREE David Aguilar
2016-07-19 18:19   ` Junio C Hamano
2016-07-19 21:06     ` Junio C Hamano
2016-07-20 22:25       ` David Aguilar
2016-07-19  3:57 ` [PATCH 3/3] difftool: use Git::* functions instead of passing around state David Aguilar
2016-07-19 18:29   ` Junio C Hamano
2016-07-19 18:15 ` [PATCH 1/3] difftool: fix argument handling in subdirs Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).