@matheusbsbs / matheus-bagliano / commits / 8b7332221d
Fork 0

difftool: add a -y shortcut for --no-prompt

This is another consistency cleanup to make git-difftool's options match git-mergetool. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Apr 7, 2009 at 01:21 UTC 8b7332221db8522fe23bf8cf25d058acea6b9142
2 files changed +17 -25
contrib/difftool/git-difftool
+3 -3
@@ -18,7 +18,7 @@ my $DIR = abs_path(dirname($0));
18 sub usage
19 {
20 print << 'USAGE';
21 -usage: git difftool [--tool=<tool>] [--no-prompt] ["git diff" options]
21 +usage: git difftool [--tool=<tool>] [-y|--no-prompt] ["git diff" options]
22 USAGE
23 exit 1;
24 }
@@ -60,11 +60,11 @@ sub generate_command
60 $ENV{GIT_DIFF_TOOL} = substr($arg, 7);
61 next;
62 }
63 - if ($arg eq '--no-prompt') {
63 + if ($arg eq '-y' || $arg eq '--no-prompt') {
64 $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
65 next;
66 }
67 - if ($arg eq '-h' or $arg eq '--help') {
67 + if ($arg eq '-h' || $arg eq '--help') {
68 usage();
69 }
70 push @command, $arg;
contrib/difftool/git-difftool.txt
+14 -22
@@ -3,35 +3,32 @@ git-difftool(1)
3
4 NAME
5 ----
6 -git-difftool - compare changes using common merge tools
6 +git-difftool - Show changes using common diff tools
7
8 SYNOPSIS
9 --------
10 -'git difftool' [--tool=<tool>] [--no-prompt] ['git diff' options]
10 +'git difftool' [--tool=<tool>] [-y|--no-prompt] [<'git diff' options>]
11
12 DESCRIPTION
13 -----------
14 'git-difftool' is a git command that allows you to compare and edit files
15 -between revisions using common merge tools. At its most basic level,
16 -'git-difftool' does what 'git-mergetool' does but its use is for non-merge
17 -situations such as when preparing commits or comparing changes against
18 -the index.
19 -
20 -'git difftool' is a frontend to 'git diff' and accepts the same
21 -arguments and options.
22 -
23 -See linkgit:git-diff[1] for the full list of supported options.
15 +between revisions using common diff tools. 'git difftool' is a frontend
16 +to 'git-diff' and accepts the same options and arguments.
17
18 OPTIONS
19 -------
20 +-y::
21 +--no-prompt::
22 + Do not prompt before launching a diff tool.
23 +
24 -t <tool>::
25 --tool=<tool>::
29 - Use the merge resolution program specified by <tool>.
26 + Use the diff tool specified by <tool>.
27 Valid merge tools are:
28 kdiff3, kompare, tkdiff, meld, xxdiff, emerge,
29 vimdiff, gvimdiff, ecmerge, and opendiff
30 +
34 -If a merge resolution program is not specified, 'git-difftool'
31 +If a diff tool is not specified, 'git-difftool'
32 will use the configuration variable `diff.tool`. If the
33 configuration variable `diff.tool` is not set, 'git-difftool'
34 will pick a suitable default.
@@ -42,7 +39,7 @@ can configure the absolute path to kdiff3 by setting
39 `difftool.kdiff3.path`. Otherwise, 'git-difftool' assumes the
40 tool is available in PATH.
41 +
45 -Instead of running one of the known merge tool programs,
42 +Instead of running one of the known diff tools,
43 'git-difftool' can be customized to run an alternative program
44 by specifying the command line to invoke in a configuration
45 variable `difftool.<tool>.cmd`.
@@ -56,8 +53,7 @@ is set to the name of the temporary file containing the contents
53 of the diff post-image. `$BASE` is provided for compatibility
54 with custom merge tool commands and has the same value as `$LOCAL`.
55
59 ---no-prompt::
60 - Do not prompt before launching a diff tool.
56 +See linkgit:git-diff[1] for the full list of supported options.
57
58 CONFIG VARIABLES
59 ----------------
@@ -65,21 +61,17 @@ CONFIG VARIABLES
61 difftool equivalents have not been defined.
62
63 diff.tool::
68 - The default merge tool to use.
64 + The default diff tool to use.
65
66 difftool.<tool>.path::
67 Override the path for the given tool. This is useful in case
68 your tool is not in the PATH.
69
70 difftool.<tool>.cmd::
75 - Specify the command to invoke the specified merge tool.
71 + Specify the command to invoke the specified diff tool.
72 +
73 See the `--tool=<tool>` option above for more details.
74
79 -merge.keepBackup::
80 - The original, unedited file content can be saved to a file with
81 - a `.orig` extension. Defaults to `true` (i.e. keep the backup files).
82 -
75 SEE ALSO
76 --------
77 linkgit:git-diff[1]::