summaryrefslogtreecommitdiff
path: root/t/t2004-checkout-cache-temp.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-10-27 07:37:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-27 19:41:56 (GMT)
commit7e41061588eab25d0c015e79aa8d04956bee482a (patch)
treef3f81e76dd35c59a34e3126c1305c809e5bc971e /t/t2004-checkout-cache-temp.sh
parent0b809c82480a870f4a46fa66f0eddc1c1b04cf6b (diff)
downloadgit-7e41061588eab25d0c015e79aa8d04956bee482a.zip
git-7e41061588eab25d0c015e79aa8d04956bee482a.tar.gz
git-7e41061588eab25d0c015e79aa8d04956bee482a.tar.bz2
checkout-index: propagate errors to exit code
If we encounter an error while checking out an explicit path, we print a message to stderr but do not actually exit with a non-zero code. While this is a plumbing command and the behavior goes all the way back to 33db5f4d90 (Add a "checkout-cache" command which does what the name suggests., 2005-04-09), this is almost certainly an oversight: - we _do_ return an exit code from checkout_file(); the caller just never reads it - errors while checking out all paths (with "-a") do result in a non-zero exit code. - it would be quite unusual not to use the exit code for an error, as otherwise the caller has no idea the command failed except by scraping stderr To keep our tests simple and portable, we can use the most obvious error: asking to checkout a path which is not in the index at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2004-checkout-cache-temp.sh')
-rwxr-xr-xt/t2004-checkout-cache-temp.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index 4308d69..a9352b0 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -88,7 +88,7 @@ test_expect_success 'checkout all stage 2 to temporary files' '
done
'
-test_expect_failure 'checkout all stages of unknown path' '
+test_expect_success 'checkout all stages of unknown path' '
rm -f path* .merge_* actual &&
test_must_fail git checkout-index --stage=all --temp \
-- does-not-exist 2>stderr &&