Allow callers of unpack_trees() to handle failure

Return an error from unpack_trees() instead of calling die(), and exit
with an error in read-tree, builtin-commit, and diff-lib. merge-recursive
already expected an error return from unpack_trees, so it doesn't need to
be changed. The merge function can return negative to abort.

This will be used in builtin-checkout -m.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
This commit is contained in:
Daniel Barkalow
2008-02-07 11:39:48 -05:00
committed by Junio C Hamano
parent 9cb76b8cdc
commit 203a2fe117
4 changed files with 56 additions and 41 deletions

View File

@ -268,7 +268,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
parse_tree(tree);
init_tree_desc(t+i, tree->buffer, tree->size);
}
unpack_trees(nr_trees, t, &opts);
if (unpack_trees(nr_trees, t, &opts))
return 128;
/*
* When reading only one tree (either the most basic form,