summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-29 17:09:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-29 17:09:35 (GMT)
commit9ce57f12280eb6a95043e28ad68ff2b6c70c09ad (patch)
tree5e4a7d25dffc8a7fc193cc7e473103f86ebcae86 /t
parente82935d9177f93a4777e8a3ee5e9d131fb884613 (diff)
parent2b52123fcf840686b69e10807fd0f985ec4167f3 (diff)
downloadgit-9ce57f12280eb6a95043e28ad68ff2b6c70c09ad.zip
git-9ce57f12280eb6a95043e28ad68ff2b6c70c09ad.tar.gz
git-9ce57f12280eb6a95043e28ad68ff2b6c70c09ad.tar.bz2
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 't')
-rwxr-xr-xt/t7800-difftool.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index dc30a51..69bde7a 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -76,6 +76,49 @@ test_expect_success PERL 'difftool forwards arguments to diff' '
rm for-diff
'
+test_expect_success PERL 'difftool ignores exit code' '
+ test_config difftool.error.cmd false &&
+ git difftool -y -t error branch
+'
+
+test_expect_success PERL 'difftool forwards exit code with --trust-exit-code' '
+ test_config difftool.error.cmd false &&
+ test_must_fail git difftool -y --trust-exit-code -t error branch
+'
+
+test_expect_success PERL 'difftool honors difftool.trustExitCode = true' '
+ test_config difftool.error.cmd false &&
+ test_config difftool.trustExitCode true &&
+ test_must_fail git difftool -y -t error branch
+'
+
+test_expect_success PERL 'difftool honors difftool.trustExitCode = false' '
+ test_config difftool.error.cmd false &&
+ test_config difftool.trustExitCode false &&
+ git difftool -y -t error branch
+'
+
+test_expect_success PERL 'difftool ignores exit code with --no-trust-exit-code' '
+ test_config difftool.error.cmd false &&
+ test_config difftool.trustExitCode true &&
+ git difftool -y --no-trust-exit-code -t error branch
+'
+
+test_expect_success PERL 'difftool stops on error with --trust-exit-code' '
+ test_when_finished "rm -f for-diff .git/fail-right-file" &&
+ test_when_finished "git reset -- for-diff" &&
+ write_script .git/fail-right-file <<-\EOF &&
+ echo "$2"
+ exit 1
+ EOF
+ >for-diff &&
+ git add for-diff &&
+ echo file >expect &&
+ test_must_fail git difftool -y --trust-exit-code \
+ --extcmd .git/fail-right-file branch >actual &&
+ test_cmp expect actual
+'
+
test_expect_success PERL 'difftool honors --gui' '
difftool_test_setup &&
test_config merge.tool bogus-tool &&
@@ -301,6 +344,14 @@ test_expect_success PERL 'say no to the second file' '
! grep br2 output
'
+test_expect_success PERL 'ending prompt input with EOF' '
+ git difftool -x cat branch </dev/null >output &&
+ ! grep master output &&
+ ! grep branch output &&
+ ! grep m2 output &&
+ ! grep br2 output
+'
+
test_expect_success PERL 'difftool --tool-help' '
git difftool --tool-help >output &&
grep tool output