Documentation: minor edits of git-lost-found manpage
[gitweb.git] / unpack-trees.c
index 79d21e2e8dd89f6e0560a2aded03f5bf3eb77f78..ee10eea24cdd37d308066721c947b2d2449e786e 100644 (file)
@@ -1,5 +1,3 @@
-#include <signal.h>
-#include <sys/time.h>
 #include "cache.h"
 #include "dir.h"
 #include "tree.h"
@@ -29,8 +27,7 @@ static struct tree_entry_list *create_tree_entry_list(struct tree *tree)
        if (!tree->object.parsed)
                parse_tree(tree);
 
-       desc.buf = tree->buffer;
-       desc.size = tree->size;
+       init_tree_desc(&desc, tree->buffer, tree->size);
 
        while (tree_entry(&desc, &one)) {
                struct tree_entry_list *entry;
@@ -384,7 +381,7 @@ int unpack_trees(struct object_list *trees, struct unpack_trees_options *o)
        int i;
        struct object_list *posn = trees;
        struct tree_entry_list df_conflict_list;
-       struct cache_entry df_conflict_entry;
+       static struct cache_entry *dfc;
 
        memset(&df_conflict_list, 0, sizeof(df_conflict_list));
        df_conflict_list.next = &df_conflict_list;
@@ -395,8 +392,10 @@ int unpack_trees(struct object_list *trees, struct unpack_trees_options *o)
        state.refresh_cache = 1;
 
        o->merge_size = len;
-       memset(&df_conflict_entry, 0, sizeof(df_conflict_entry));
-       o->df_conflict_entry = &df_conflict_entry;
+
+       if (!dfc)
+               dfc = xcalloc(1, sizeof(struct cache_entry) + 1);
+       o->df_conflict_entry = dfc;
 
        if (len) {
                posns = xmalloc(len * sizeof(struct tree_entry_list *));