summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9e1122)
raw | patch | inline | side by side (parent: a9e1122)
author | David Aguilar <davvid@gmail.com> | |
Fri, 15 Jan 2010 22:03:43 +0000 (14:03 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 15 Jan 2010 23:04:31 +0000 (15:04 -0800) |
This adds '-x' as a shorthand for the '--extcmd' option.
Arguments to '--extcmd' can be specified separately, which
was not originally possible.
This also fixes the brief help text so that it mentions
both '-x' and '--extcmd'.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Arguments to '--extcmd' can be specified separately, which
was not originally possible.
This also fixes the brief help text so that it mentions
both '-x' and '--extcmd'.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-difftool.txt | patch | blob | history | |
git-difftool.perl | patch | blob | history | |
t/t7800-difftool.sh | patch | blob | history |
index f67d2db761e28aa1d69a182c0361718ee1ec751c..5c68cff9058654aff4657cd5f86f8dc2682eccde 100644 (file)
SYNOPSIS
--------
-'git difftool' [--tool=<tool>] [-y|--no-prompt|--prompt] [<'git diff' options>]
+'git difftool' [<options>] <commit>{0,2} [--] [<path>...]
DESCRIPTION
-----------
of the diff post-image. `$BASE` is provided for compatibility
with custom merge tool commands and has the same value as `$LOCAL`.
+-x <command>::
--extcmd=<command>::
Specify a custom command for viewing diffs.
'git-difftool' ignores the configured defaults and runs
diff --git a/git-difftool.perl b/git-difftool.perl
index f8ff245756c237894523c01068170955f988df75..d975d072dbf0fab36266c3f3a71a69875206e4d8 100755 (executable)
--- a/git-difftool.perl
+++ b/git-difftool.perl
#!/usr/bin/env perl
-# Copyright (c) 2009 David Aguilar
+# Copyright (c) 2009, 2010 David Aguilar
#
# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
# git-difftool--helper script.
sub usage
{
print << 'USAGE';
-usage: git difftool [-g|--gui] [-t|--tool=<tool>] [-y|--no-prompt]
- ["git diff" options]
+usage: git difftool [-t|--tool=<tool>] [-x|--extcmd=<cmd>]
+ [-y|--no-prompt] [-g|--gui]
+ ['git diff' options]
USAGE
exit 1;
}
$skip_next = 1;
next;
}
- if ($arg =~ /^--extcmd=/) {
- $ENV{GIT_DIFFTOOL_EXTCMD} = substr($arg, 9);
- next;
- }
if ($arg =~ /^--tool=/) {
$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
next;
}
+ if ($arg eq '-x' || $arg eq '--extcmd') {
+ usage() if $#ARGV <= $idx;
+ $ENV{GIT_DIFFTOOL_EXTCMD} = $ARGV[$idx + 1];
+ $skip_next = 1;
+ next;
+ }
+ if ($arg =~ /^--extcmd=/) {
+ $ENV{GIT_DIFFTOOL_EXTCMD} = substr($arg, 9);
+ next;
+ }
if ($arg eq '-g' || $arg eq '--gui') {
my $tool = Git::command_oneline('config',
'diff.guitool');
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 1d9e07b0d84347be4a6bbd5d8b766f20fede1786..69e1c3415983fea50c3a059e5fa440560591737d 100755 (executable)
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
test_expect_success 'difftool --extcmd=cat' '
diff=$(git difftool --no-prompt --extcmd=cat branch) &&
test "$diff" = branch"$LF"master
+'
+test_expect_success 'difftool --extcmd cat' '
+ diff=$(git difftool --no-prompt --extcmd cat branch) &&
+ test "$diff" = branch"$LF"master
+'
+test_expect_success 'difftool -x cat' '
+ diff=$(git difftool --no-prompt -x cat branch) &&
+ test "$diff" = branch"$LF"master
'