summaryrefslogtreecommitdiff
path: root/git-difftool.perl
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2009-12-22 21:27:14 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-03 00:29:35 -0800
commit4cefa495ca91ad833084ebf3f73c77997920ae9b (patch)
tree6ee3a42ff6cf26d688a82e1d494c11a0d9c9fdef /git-difftool.perl
parent23218bbd2ea7f919b93245489e544a55165ec466 (diff)
downloadgit-4cefa495ca91ad833084ebf3f73c77997920ae9b.tar.gz
git-difftool: Add '--gui' for selecting a GUI tool
Users might prefer to have git-difftool use a different tool when run from a Git GUI. This teaches git-difftool to honor 'diff.guitool' when the '--gui' option is specified. This allows users to configure their preferred command-line diff tool in 'diff.tool' and a GUI diff tool in 'diff.guitool'. Reference: http://article.gmane.org/gmane.comp.version-control.git/133386 Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-difftool.perl')
-rwxr-xr-xgit-difftool.perl13
1 files changed, 12 insertions, 1 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index ba5e60a45e..8c836e4c76 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -15,13 +15,16 @@ use warnings;
use Cwd qw(abs_path);
use File::Basename qw(dirname);
+require Git;
+
my $DIR = abs_path(dirname($0));
sub usage
{
print << 'USAGE';
-usage: git difftool [--tool=<tool>] [-y|--no-prompt] ["git diff" options]
+usage: git difftool [-g|--gui] [-t|--tool=<tool>] [-y|--no-prompt]
+ ["git diff" options]
USAGE
exit 1;
}
@@ -63,6 +66,14 @@ sub generate_command
$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
next;
}
+ if ($arg eq '-g' || $arg eq '--gui') {
+ my $tool = Git::command_oneline('config',
+ 'diff.guitool');
+ if (length($tool)) {
+ $ENV{GIT_DIFF_TOOL} = $tool;
+ }
+ next;
+ }
if ($arg eq '-y' || $arg eq '--no-prompt') {
$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
delete $ENV{GIT_DIFFTOOL_PROMPT};