summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2016-01-12 04:57:34 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-01-12 11:11:52 -0800
commit4be49d756894daca0e8a4477d36c6ed1096ccddc (patch)
treed013f146189a190d3260baaa597067a1fb10a0ad /t
parentcreate_symref: write reflog while holding lock (diff)
downloadtgif-4be49d756894daca0e8a4477d36c6ed1096ccddc.tar.xz
checkout,clone: check return value of create_symref
It's unlikely that we would fail to create or update a symbolic ref (especially HEAD), but if we do, we should notice and complain. Note that there's no need to give more details in our error message; create_symref will already have done so. While we're here, let's also fix a minor memory leak in clone. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t2011-checkout-invalid-head.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t2011-checkout-invalid-head.sh b/t/t2011-checkout-invalid-head.sh
index 300f8bf25c..d444d5ee41 100755
--- a/t/t2011-checkout-invalid-head.sh
+++ b/t/t2011-checkout-invalid-head.sh
@@ -19,4 +19,10 @@ test_expect_success 'checkout master from invalid HEAD' '
git checkout master --
'
+test_expect_success 'checkout notices failure to lock HEAD' '
+ test_when_finished "rm -f .git/HEAD.lock" &&
+ >.git/HEAD.lock &&
+ test_must_fail git checkout -b other
+'
+
test_done