builtin/notes: convert to struct object_id
[gitweb.git] / cache-tree.c
index 35d507ed79641f114e6af9e39466c26c744f022c..ec23d8c03d10bd3815f59c2d70ae5eb45170aaad 100644 (file)
@@ -354,7 +354,9 @@ static int update_one(struct cache_tree *it,
                        entlen = pathlen - baselen;
                        i++;
                }
-               if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1)) {
+
+               if (is_null_sha1(sha1) ||
+                   (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))) {
                        strbuf_release(&buffer);
                        if (expected_missing)
                                return -1;
@@ -672,7 +674,7 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
                        cnt++;
                else {
                        struct cache_tree_sub *sub;
-                       struct tree *subtree = lookup_tree(entry.oid->hash);
+                       struct tree *subtree = lookup_tree(entry.oid);
                        if (!subtree->object.parsed)
                                parse_tree(subtree);
                        sub = cache_tree_sub(it, entry.path);