summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-19 05:01:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-19 05:17:22 (GMT)
commitc4758d3c9342ea2245ca51f30f1cbf27ecc16ced (patch)
treeb14261a02ed60aabbe5419fab99cc1b046419ac6 /unpack-trees.c
parent8a785dc921386dac628a2a04ebe5f48deb7cc1a8 (diff)
downloadgit-c4758d3c9342ea2245ca51f30f1cbf27ecc16ced.zip
git-c4758d3c9342ea2245ca51f30f1cbf27ecc16ced.tar.gz
git-c4758d3c9342ea2245ca51f30f1cbf27ecc16ced.tar.bz2
Fix read-tree not to discard errors
This fixes the issue identified with recently added tests to t1004 Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 4b359e0..a59f475 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -54,13 +54,14 @@ static void unlink_entry(char *name, char *last_symlink)
}
static struct checkout state;
-static void check_updates(struct unpack_trees_options *o)
+static int check_updates(struct unpack_trees_options *o)
{
unsigned cnt = 0, total = 0;
struct progress *progress = NULL;
char last_symlink[PATH_MAX];
struct index_state *index = &o->result;
int i;
+ int errs = 0;
if (o->update && o->verbose_update) {
for (total = cnt = 0; cnt < index->cache_nr; cnt++) {
@@ -90,12 +91,13 @@ static void check_updates(struct unpack_trees_options *o)
if (ce->ce_flags & CE_UPDATE) {
ce->ce_flags &= ~CE_UPDATE;
if (o->update) {
- checkout_entry(ce, &state, NULL);
+ errs |= checkout_entry(ce, &state, NULL);
*last_symlink = '\0';
}
}
}
stop_progress(&progress);
+ return errs != 0;
}
static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_options *o)
@@ -369,7 +371,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
return unpack_failed(o, "Merge requires file-level merging");
o->src_index = NULL;
- check_updates(o);
+ if (check_updates(o))
+ return -1;
if (o->dst_index)
*o->dst_index = o->result;
return 0;