diff options
author | Jeff King <peff@peff.net> | 2013-03-25 16:23:59 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-27 13:47:15 -0700 |
commit | 0aac7bb287645dd72ad8ad6b805128b8ff7f111f (patch) | |
tree | 72fde031f0cd01787d5d531f257a920006dd9336 /builtin | |
parent | 0e15ad9b730a1516f8a786523266707c4d26f5ab (diff) | |
download | git-0aac7bb287645dd72ad8ad6b805128b8ff7f111f.tar.gz |
clone: die on errors from unpack_trees
When clone is populating the working tree, it ignores the
return status from unpack_trees; this means we may report a
successful clone, even when the checkout fails.
When checkout fails, we may want to leave the $GIT_DIR in
place, as it might be possible to recover the data through
further use of "git checkout" (e.g., if the checkout failed
due to a transient error, disk full, etc). However, we
already die on a number of other checkout-related errors, so
this patch follows that pattern.
In addition to marking a now-passing test, we need to adjust
t5710, which blindly assumed it could make bogus clones of
very deep alternates hierarchies. By using "--bare", we can
avoid it actually touching any objects.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index e0aaf13583..7d48ef3b4e 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -579,7 +579,8 @@ static int checkout(void) tree = parse_tree_indirect(sha1); parse_tree(tree); init_tree_desc(&t, tree->buffer, tree->size); - unpack_trees(1, &t, &opts); + if (unpack_trees(1, &t, &opts) < 0) + die(_("unable to checkout working tree")); if (write_cache(fd, active_cache, active_nr) || commit_locked_index(lock_file)) |