From: David Aguilar Date: Sat, 17 Mar 2012 03:08:55 GMT Subject: Re: [PATCH 7/9] difftool: teach difftool to handle directory diffs Message-ID: In-Reply-To: <1331949574-15192-1-git-send-email-tim.henigan@gmail.com> On Fri, Mar 16, 2012 at 6:59 PM, Tim Henigan wrote: > Prior to this commit, the difftool utility could only open files one > at a time.  The new '--dir-diff' option copies all the modified files > to a temporary location and runs a directory diff on them. > > Signed-off-by: Tim Henigan > --- > >  Documentation/git-difftool.txt |    6 ++ >  git-difftool--helper.sh        |   20 ++++-- >  git-difftool.perl              |  142 ++++++++++++++++++++++++++++++++++++---- >  3 files changed, 150 insertions(+), 18 deletions(-) > > diff --git a/git-difftool.perl b/git-difftool.perl > index 8498089..0262c7a 100755 > --- a/git-difftool.perl > +++ b/git-difftool.perl > @@ -22,15 +28,109 @@ sub usage >        print << 'USAGE'; >  usage: git difftool [-t|--tool=] [-x|--extcmd=] >                     [-y|--no-prompt]   [-g|--gui] > +                    [-d|--dir-diff] >                     ['git diff' options] >  USAGE >        exit($exitcode); >  } > > +sub setup_dir_diff > +{ > +       # Run the diff; exit immediately if no diff found > +       my $repo = Git->repository(); > +       my $diffrtn = $repo->command_oneline(['diff', '--raw', '--no-abbrev', '-z', @ARGV]); > +       exit(0) if (length($diffrtn) == 0); > + > +       # Setup temp directories > +       my $tmpdir = tempdir('/tmp/git-diffall.XXXXX', CLEANUP => 1); Is it okay to hardcode /tmp here, or should we instead do something like this?: my $tmp = $ENV{TMPDIR} || '/tmp'; -- David