cache-tree: use is_empty_tree_oid
[gitweb.git] / unpack-trees.c
index c9f6e314d5cd830d63236ea88c5ff9c7baf418bb..038ef7b92683257f3a47806d91a0dd560549d363 100644 (file)
@@ -195,10 +195,10 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
 static struct cache_entry *dup_entry(const struct cache_entry *ce)
 {
        unsigned int size = ce_size(ce);
-       struct cache_entry *new = xmalloc(size);
+       struct cache_entry *new_entry = xmalloc(size);
 
-       memcpy(new, ce, size);
-       return new;
+       memcpy(new_entry, ce, size);
+       return new_entry;
 }
 
 static void add_entry(struct unpack_trees_options *o,
@@ -391,6 +391,7 @@ static int check_updates(struct unpack_trees_options *o)
                        fetch_objects(repository_format_partial_clone,
                                      &to_fetch);
                fetch_if_missing = fetch_if_missing_store;
+               oid_array_clear(&to_fetch);
        }
        for (i = 0; i < index->cache_nr; i++) {
                struct cache_entry *ce = index->cache[i];
@@ -1286,7 +1287,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
        o->result.split_index = o->src_index->split_index;
        if (o->result.split_index)
                o->result.split_index->refcount++;
-       hashcpy(o->result.sha1, o->src_index->sha1);
+       oidcpy(&o->result.oid, &o->src_index->oid);
        o->merge_size = len;
        mark_all_ce_unused(o->src_index);