Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-03-27 02:22:09 +0400
committerJunio C Hamano <gitster@pobox.com>2013-03-30 02:20:55 +0400
commitd3b34622f699ff14646de4ec1b1ab9afb0bcb056 (patch)
treee6f2b16684bd09acf7942899db80af78d970dae6 /t/t1060-object-corruption.sh
parent0433ad128c59f233046b3f8a68246ca3a8a77af8 (diff)
clone: leave repo in place after checkout errors
If we manage to clone a remote repository but run into an error in the checkout, it is probably sane to leave the repo directory in place. That lets the user examine the situation without spending time to re-clone from the remote (which may be a lengthy process). Rather than try to convert each die() from the checkout code path into an error(), we simply set a flag that tells the "remove_junk" atexit function to print a helpful message and leave the repo in place. Note that the test added in this patch actually passes without the code change. The reason is that the cleanup code is buggy; we chdir into the working tree for the checkout, but still may use relative paths to remove the directories (which means if you cloned into "foo", we would accidentally remove "foo" from the working tree!). There's no point in fixing it now, since this patch means we will never try to remove anything after the chdir, anyway. [jc: replaced the message with a more succinct version from Jonathan] Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1060-object-corruption.sh')
-rwxr-xr-xt/t1060-object-corruption.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t1060-object-corruption.sh b/t/t1060-object-corruption.sh
index c65a57cd22..3f8705139d 100755
--- a/t/t1060-object-corruption.sh
+++ b/t/t1060-object-corruption.sh
@@ -89,6 +89,10 @@ test_expect_success 'clone --local detects corruption' '
test_must_fail git clone --local bit-error corrupt-checkout
'
+test_expect_success 'error detected during checkout leaves repo intact' '
+ test_path_is_dir corrupt-checkout/.git
+'
+
test_expect_success 'clone --local detects missing objects' '
test_must_fail git clone --local missing missing-checkout
'