Makefile: dedup list of files obtained from ls-files
[gitweb.git] / packfile.c
index 8c6b47cc777708d4f8e450337f2b9d205f43591b..d2bcb2f860c50056b7014b8a7dbf804baad79be8 100644 (file)
@@ -309,7 +309,7 @@ void close_pack_windows(struct packed_git *p)
        }
 }
 
-static int close_pack_fd(struct packed_git *p)
+int close_pack_fd(struct packed_git *p)
 {
        if (p->pack_fd < 0)
                return 0;
@@ -994,11 +994,8 @@ void reprepare_packed_git(struct repository *r)
 {
        struct object_directory *odb;
 
-       for (odb = r->objects->odb; odb; odb = odb->next) {
-               oid_array_clear(&odb->loose_objects_cache);
-               memset(&odb->loose_objects_subdir_seen, 0,
-                      sizeof(odb->loose_objects_subdir_seen));
-       }
+       for (odb = r->objects->odb; odb; odb = odb->next)
+               odb_clear_loose_cache(odb);
 
        r->objects->approximate_object_count_valid = 0;
        r->objects->packed_git_initialized = 0;
@@ -1151,12 +1148,13 @@ void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1)
        p->num_bad_objects++;
 }
 
-const struct packed_git *has_packed_and_bad(const unsigned char *sha1)
+const struct packed_git *has_packed_and_bad(struct repository *r,
+                                           const unsigned char *sha1)
 {
        struct packed_git *p;
        unsigned i;
 
-       for (p = the_repository->objects->packed_git; p; p = p->next)
+       for (p = r->objects->packed_git; p; p = p->next)
                for (i = 0; i < p->num_bad_objects; i++)
                        if (hasheq(sha1,
                                   p->bad_object_sha1 + the_hash_algo->rawsz * i))
@@ -2100,7 +2098,7 @@ static int add_promisor_object(const struct object_id *oid,
                         */
                        return 0;
                while (tree_entry_gently(&desc, &entry))
-                       oidset_insert(set, entry.oid);
+                       oidset_insert(set, &entry.oid);
        } else if (obj->type == OBJ_COMMIT) {
                struct commit *commit = (struct commit *) obj;
                struct commit_list *parents = commit->parents;