summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-09-22 21:24:22 +1000
committerJunio C Hamano <gitster@pobox.com>2011-09-22 11:35:44 -0700
commit17d26a4d0485229c24b649013a40d5928ba223cc (patch)
treecfb5da4ebf1e1a101a57b7bd679aa58f912800cf /unpack-trees.c
parentf696543dad6c7ba27b0c4fab167a5687263a9ba0 (diff)
downloadgit-17d26a4d0485229c24b649013a40d5928ba223cc.tar.gz
sparse checkout: show error messages when worktree shaping fails
verify_* functions can queue errors up and to be printed later at label return_failed. In case of errors, do not go to label "done" directly because all queued messages would be dropped on the floor. Found-by: Joshua Jensen <jjensen@workspacewhiz.com> Tracked-down-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 07f8364244..8d4fbaa4ad 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1089,6 +1089,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
*/
mark_new_skip_worktree(o->el, &o->result, CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
+ ret = 0;
for (i = 0; i < o->result.cache_nr; i++) {
struct cache_entry *ce = o->result.cache[i];
@@ -1101,17 +1102,23 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
* correct CE_NEW_SKIP_WORKTREE
*/
if (ce->ce_flags & CE_ADDED &&
- verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, o))
- return -1;
+ verify_absent(ce, ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, o)) {
+ if (!o->show_all_errors)
+ goto return_failed;
+ ret = -1;
+ }
if (apply_sparse_checkout(ce, o)) {
+ if (!o->show_all_errors)
+ goto return_failed;
ret = -1;
- goto done;
}
if (!ce_skip_worktree(ce))
empty_worktree = 0;
}
+ if (ret < 0)
+ goto return_failed;
if (o->result.cache_nr && empty_worktree) {
/* dubious---why should this fail??? */
ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");