File tree Expand file tree Collapse file tree 3 files changed +24
-8
lines changed
Expand file tree Collapse file tree 3 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ git-difftool - Show changes using common diff tools
77
88SYNOPSIS
99--------
10- 'git difftool' [--tool=<tool >] [-y|--no-prompt|--prompt ] [<'git diff' options> ]
10+ 'git difftool' [<options >] <commit>{0,2} [-- ] [<path>... ]
1111
1212DESCRIPTION
1313-----------
@@ -58,6 +58,7 @@ is set to the name of the temporary file containing the contents
5858of the diff post-image. `$BASE` is provided for compatibility
5959with custom merge tool commands and has the same value as `$LOCAL`.
6060
61+ -x <command>::
6162--extcmd=<command>::
6263 Specify a custom command for viewing diffs.
6364 'git-difftool' ignores the configured defaults and runs
Original file line number Diff line number Diff line change 11# !/usr/bin/env perl
2- # Copyright (c) 2009 David Aguilar
2+ # Copyright (c) 2009, 2010 David Aguilar
33#
44# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
55# git-difftool--helper script.
2323sub usage
2424{
2525 print << 'USAGE' ;
26- usage: git difftool [-g|--gui] [-t|--tool=<tool>] [-y|--no-prompt]
27- ["git diff" options]
26+ usage: git difftool [-t|--tool=<tool>] [-x|--extcmd=<cmd>]
27+ [-y|--no-prompt] [-g|--gui]
28+ ['git diff' options]
2829USAGE
2930 exit 1;
3031}
@@ -62,14 +63,20 @@ sub generate_command
6263 $skip_next = 1;
6364 next ;
6465 }
65- if ($arg =~ / ^--extcmd=/ ) {
66- $ENV {GIT_DIFFTOOL_EXTCMD } = substr ($arg , 9);
67- next ;
68- }
6966 if ($arg =~ / ^--tool=/ ) {
7067 $ENV {GIT_DIFF_TOOL } = substr ($arg , 7);
7168 next ;
7269 }
70+ if ($arg eq ' -x' || $arg eq ' --extcmd' ) {
71+ usage() if $#ARGV <= $idx ;
72+ $ENV {GIT_DIFFTOOL_EXTCMD } = $ARGV [$idx + 1];
73+ $skip_next = 1;
74+ next ;
75+ }
76+ if ($arg =~ / ^--extcmd=/ ) {
77+ $ENV {GIT_DIFFTOOL_EXTCMD } = substr ($arg , 9);
78+ next ;
79+ }
7380 if ($arg eq ' -g' || $arg eq ' --gui' ) {
7481 my $tool = Git::command_oneline(' config' ,
7582 ' diff.guitool' );
Original file line number Diff line number Diff line change @@ -225,8 +225,16 @@ test_expect_success 'difftool.<tool>.path' '
225225test_expect_success ' difftool --extcmd=cat' '
226226 diff=$(git difftool --no-prompt --extcmd=cat branch) &&
227227 test "$diff" = branch"$LF"master
228+ '
228229
230+ test_expect_success ' difftool --extcmd cat' '
231+ diff=$(git difftool --no-prompt --extcmd cat branch) &&
232+ test "$diff" = branch"$LF"master
233+ '
229234
235+ test_expect_success ' difftool -x cat' '
236+ diff=$(git difftool --no-prompt -x cat branch) &&
237+ test "$diff" = branch"$LF"master
230238
231239
232240'
You can’t perform that action at this time.
0 commit comments