Re: [PATCH 7/9] difftool: teach difftool to handle directory diffs
On Fri, Mar 16, 2012 at 6:59 PM, Tim Henigan <tim.henigan@gmail.com> wrote:
Show 35 quoted lines
> 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 <tim.henigan@gmail.com>
> ---
>
> 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=<tool>] [-x|--extcmd=<cmd>]
> [-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