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

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

From
David Aguilar <davvid@gmail.com>
Date
Mar 17, 2012, 03:08 UTC
Message-ID
<CAJDDKr4mc7OwUzE9d51KkgMaMauVJx_T=rdmXnhEc_a0hc0LGQ@mail.gmail.com>
In-Reply-To
<1331949574-15192-1-git-send-email-tim.henigan@gmail.com>
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
Previous: Tim HeniganNext: Tim Henigan
Message 2 of 8 in “difftool: teach difftool to handle directory diffs”
  1. 7/9 difftool: teach difftool to handle directory diffsTim Henigan, Mar 17, 2012
  2. David AguilarMar 17, 2012
  3. Tim HeniganMar 17, 2012
  4. Jakub NarebskiMar 17, 2012
  5. Tim HeniganMar 18, 2012
  6. Tim HeniganMar 20, 2012
  7. Junio C HamanoMar 20, 2012
  8. Tim HeniganMar 20, 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.