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

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

From
David Aguilar <davvid@gmail.com>
Date
Apr 13, 2012, 02:53 UTC
Message-ID
<CAJDDKr4UbN3izmqa89CCH7OY4c9LOH0S2EbdUCxHK3G6GHd4xQ@mail.gmail.com>
In-Reply-To
<7v62d4692l.fsf@alter.siamese.dyndns.org>
On Thu, Apr 12, 2012 at 12:31 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> Tim Henigan <tim.henigan@gmail.com> 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.
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
Previous: Junio C HamanoNext: Tim Henigan
Message 5 of 6 in “difftool: teach difftool to handle directory diffs”
  1. 8/9 difftool: teach difftool to handle directory diffsTim Henigan, Apr 12, 2012
  2. Junio C HamanoApr 12, 2012
  3. Tim HeniganApr 12, 2012
  4. Junio C HamanoApr 12, 2012
  5. David AguilarApr 13, 2012
  6. Tim HeniganApr 13, 2012

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.