summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-difftool.perl9
1 files changed, 5 insertions, 4 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index 93e84e8d3d..4555cd8b1c 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -20,6 +20,7 @@ use Git;
sub usage
{
+ my $exitcode = shift;
print << 'USAGE';
usage: git difftool [-t|--tool=<tool>]
[-x|--extcmd=<cmd>]
@@ -27,7 +28,7 @@ usage: git difftool [-t|--tool=<tool>]
[--prompt] [-y|--no-prompt]
['git diff' options]
USAGE
- exit 1;
+ exit($exitcode);
}
sub setup_environment
@@ -58,14 +59,14 @@ GetOptions('g|gui!' => \$gui,
'x|extcmd:s' => \$extcmd);
if (defined($help)) {
- usage();
+ usage(0);
}
if (defined($difftool_cmd)) {
if (length($difftool_cmd) > 0) {
$ENV{GIT_DIFF_TOOL} = $difftool_cmd;
} else {
print "No <tool> given for --tool=<tool>\n";
- usage();
+ usage(1);
}
}
if (defined($extcmd)) {
@@ -73,7 +74,7 @@ if (defined($extcmd)) {
$ENV{GIT_DIFFTOOL_EXTCMD} = $extcmd;
} else {
print "No <cmd> given for --extcmd=<cmd>\n";
- usage();
+ usage(1);
}
}
if ($gui) {