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
This commit is contained in:
Junio C Hamano
2014-10-29 10:09:35 -07:00
4 changed files with 85 additions and 1 deletions

View File

@ -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