aboutsummaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-26 18:44:15 -0800
committerJunio C Hamano <junkio@cox.net>2005-12-26 18:44:15 -0800
commite5f5219a4f1faf3b4e1816fad3a6296a1d39b878 (patch)
treee41c6fb839732b2fe45bd9416a22411ed3035a07 /read-tree.c
parent6ab58895cd951f6f5c96fa432afb122cfeb12746 (diff)
parent975b31dc6e12fba8f7b067ddbe32230995e05400 (diff)
downloadgit-6649c46643a721ec193b62383f8ba994f94a0b90.tar.gz
git-6649c46643a721ec193b62383f8ba994f94a0b90.tar.xz
GIT 1.0.5v1.0.5
Minor fixes. Starting from this one I won't be touching debian/ directory since the official maintainer seems to be reasonably quick to package up things. The packaging procedure used there seems to be quite different from what I have, so I'd like to avoid potential confusion and reduce work by the official maintainer and myself. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/read-tree.c b/read-tree.c
index e3b9c0d9f..a46c6fe2f 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -294,17 +294,20 @@ static int unpack_trees(merge_fn_t fn)
{
int indpos = 0;
unsigned len = object_list_length(trees);
- struct tree_entry_list **posns =
- xmalloc(len * sizeof(struct tree_entry_list *));
+ struct tree_entry_list **posns;
int i;
struct object_list *posn = trees;
merge_size = len;
- for (i = 0; i < len; i++) {
- posns[i] = ((struct tree *) posn->item)->entries;
- posn = posn->next;
+
+ if (len) {
+ posns = xmalloc(len * sizeof(struct tree_entry_list *));
+ for (i = 0; i < len; i++) {
+ posns[i] = ((struct tree *) posn->item)->entries;
+ posn = posn->next;
+ }
+ if (unpack_trees_rec(posns, len, "", fn, &indpos))
+ return -1;
}
- if (unpack_trees_rec(posns, len, "", fn, &indpos))
- return -1;
if (trivial_merges_only && nontrivial_merge)
die("Merge requires file-level merging");