summaryrefslogtreecommitdiff
path: root/git-difftool.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-29 10:09:35 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-29 10:09:35 -0700
commit9ce57f12280eb6a95043e28ad68ff2b6c70c09ad (patch)
tree5e4a7d25dffc8a7fc193cc7e473103f86ebcae86 /git-difftool.perl
parente82935d9177f93a4777e8a3ee5e9d131fb884613 (diff)
parent2b52123fcf840686b69e10807fd0f985ec4167f3 (diff)
downloadgit-9ce57f12280eb6a95043e28ad68ff2b6c70c09ad.tar.gz
Merge branch 'da/difftool'
Allow diff tool backend to stop early by exiting with a non-zero status. * da/difftool: difftool: add support for --trust-exit-code difftool--helper: exit when reading a prompt answer fails
Diffstat (limited to 'git-difftool.perl')
-rwxr-xr-xgit-difftool.perl12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index 598fcc23b9..7df7c8a9a7 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -342,6 +342,7 @@ sub main
symlinks => $^O ne 'cygwin' &&
$^O ne 'MSWin32' && $^O ne 'msys',
tool_help => undef,
+ trust_exit_code => undef,
);
GetOptions('g|gui!' => \$opts{gui},
'd|dir-diff' => \$opts{dirdiff},
@@ -352,6 +353,8 @@ sub main
'no-symlinks' => sub { $opts{symlinks} = 0; },
't|tool:s' => \$opts{difftool_cmd},
'tool-help' => \$opts{tool_help},
+ 'trust-exit-code' => \$opts{trust_exit_code},
+ 'no-trust-exit-code' => sub { $opts{trust_exit_code} = 0; },
'x|extcmd:s' => \$opts{extcmd});
if (defined($opts{help})) {
@@ -383,6 +386,15 @@ sub main
}
}
+ if (!defined $opts{trust_exit_code}) {
+ $opts{trust_exit_code} = Git::config_bool('difftool.trustExitCode');
+ }
+ if ($opts{trust_exit_code}) {
+ $ENV{GIT_DIFFTOOL_TRUST_EXIT_CODE} = 'true';
+ } else {
+ $ENV{GIT_DIFFTOOL_TRUST_EXIT_CODE} = 'false';
+ }
+
# In directory diff mode, 'git-difftool--helper' is called once
# to compare the a/b directories. In file diff mode, 'git diff'
# will invoke a separate instance of 'git-difftool--helper' for