diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-26 18:45:30 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-26 18:45:30 -0800 |
commit | 36de72aa9dc3b7daf8cf2770c840f39bb0d2ae70 (patch) | |
tree | ff61e0bd4d4454a4b34e920f80dbc1b4e427383d /read-tree.c | |
parent | 2ed7542fad01558306b6187e3b19c64243234349 (diff) | |
parent | e5f5219a4f1faf3b4e1816fad3a6296a1d39b878 (diff) | |
download | git-36de72aa9dc3b7daf8cf2770c840f39bb0d2ae70.tar.gz git-36de72aa9dc3b7daf8cf2770c840f39bb0d2ae70.tar.xz |
Merge fixes up to GIT 1.0.5
Diffstat (limited to 'read-tree.c')
-rw-r--r-- | read-tree.c | 17 |
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"); |