Re: [PATCH 8/9 v12] difftool: teach difftool to handle directory diffs

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 8/9 v12] difftool: teach difftool to handle directory diffs

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:34

Tim Henigan [off-list ref] writes:
Would the following change be better?

-     my $cmd = "git diff --raw --no-abbrev -z " . join(" ", @ARGV);
+     my $cmd = "git diff --raw --no-abbrev -z @ARGV";
They look exactly the same to me.

Re: [PATCH 8/9 v12] difftool: teach difftool to handle directory diffs

From: David Aguilar <hidden>
Date: 2016-06-15 22:53:34

On Thu, Apr 12, 2012 at 12:31 PM, Junio C Hamano [off-list ref] wrote:
Tim Henigan [off-list ref] writes:
quoted
Would the following change be better?

-     my $cmd = "git diff --raw --no-abbrev -z " . join(" ", @ARGV);
+     my $cmd = "git diff --raw --no-abbrev -z @ARGV";
They look exactly the same to me.
The issue is that this does not properly handle shell characters, IFS, etc.

I think a simple solution would be to use git diff --exit-code --quiet here.

e.g.

    my $rc = system('git', 'diff', '--exit-code', '--quiet', @ARGV);

That avoids the shell and properly handles shell meta-characters, IFS, etc.
-- 
David

Re: [PATCH 8/9 v12] difftool: teach difftool to handle directory diffs

From: Tim Henigan <hidden>
Date: 2016-06-15 22:53:34

On Thu, Apr 12, 2012 at 10:53 PM, David Aguilar [off-list ref] wrote:
The issue is that this does not properly handle shell characters, IFS, etc.

I think a simple solution would be to use git diff --exit-code --quiet here.

e.g.

   my $rc = system('git', 'diff', '--exit-code', '--quiet', @ARGV);

That avoids the shell and properly handles shell meta-characters, IFS, etc.
The problem is that I need the output of 'git diff' to drive the rest
of the script.  Getting STDOUT from a system() call is difficult, so I
switched to backticks.  Obviously I missed the regression.

The best solution seems to be to find a way to make
'Git->repository->command*' to work with $GIT_DIR and $GIT_WORK_TREE.
I will send v13 with this change soon.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help