diff options
-rw-r--r-- | Documentation/git-difftool.txt | 10 | ||||
-rwxr-xr-x | git-difftool.perl | 14 |
2 files changed, 18 insertions, 6 deletions
diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt index a03515f1ec..4b2a20ec67 100644 --- a/Documentation/git-difftool.txt +++ b/Documentation/git-difftool.txt @@ -30,10 +30,9 @@ OPTIONS -t <tool>:: --tool=<tool>:: - Use the diff tool specified by <tool>. - Valid merge tools are: - araxis, bc3, diffuse, emerge, ecmerge, gvimdiff, kdiff3, - kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff. + Use the diff tool specified by <tool>. Valid values include + emerge, kompare, meld, and vimdiff. Run `git difftool --tool-help` + for the list of valid <tool> settings. + If a diff tool is not specified, 'git difftool' will use the configuration variable `diff.tool`. If the @@ -61,6 +60,9 @@ of the diff post-image. `$MERGED` is the name of the file which is being compared. `$BASE` is provided for compatibility with custom merge tool commands and has the same value as `$MERGED`. +--tool-help:: + Print a list of diff tools that may be used with `--tool`. + -x <command>:: --extcmd=<command>:: Specify a custom command for viewing diffs. diff --git a/git-difftool.perl b/git-difftool.perl index ced1615e21..ad777efa2b 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -14,7 +14,7 @@ use 5.008; use strict; use warnings; use Cwd qw(abs_path); -use File::Basename qw(dirname); +use File::Basename qw(dirname basename); require Git; @@ -24,7 +24,8 @@ my $DIR = abs_path(dirname($0)); sub usage { print << 'USAGE'; -usage: git difftool [-t|--tool=<tool>] [-x|--extcmd=<cmd>] +usage: git difftool [-t|--tool=<tool>] [--tool-help] + [-x|--extcmd=<cmd>] [-y|--no-prompt] [-g|--gui] ['git diff' options] USAGE @@ -100,6 +101,15 @@ sub generate_command if ($arg eq '-h' || $arg eq '--help') { usage(); } + if ($arg eq '--tool-help') { + my $gitpath = Git::exec_path(); + print "'git difftool --tool=<tool>' may be set to one of the following:\n"; + for (glob "$gitpath/mergetools/*") { + next if /defaults$/; + print "\t" . basename($_) . "\n"; + } + exit(1); + } push @command, $arg; } if ($prompt eq 'yes') { |