]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: convert has_packed_and_bad() to object_id
authorRené Scharfe <l.s.r@web.de>
Sat, 11 Sep 2021 20:42:20 +0000 (22:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 12 Sep 2021 23:14:32 +0000 (16:14 -0700)
The single caller has a full object ID, so pass it on instead of just
its hash member.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c
packfile.c
packfile.h

index fb5a385a06d4405e02e258acf940ca9e58cf9c79..01e7058b4e661c7c779bbf9084acb93129ea6a0f 100644 (file)
@@ -1725,7 +1725,7 @@ void *read_object_file_extended(struct repository *r,
                die(_("loose object %s (stored in %s) is corrupt"),
                    oid_to_hex(repl), path);
 
-       if ((p = has_packed_and_bad(r, repl->hash)) != NULL)
+       if ((p = has_packed_and_bad(r, repl)) != NULL)
                die(_("packed object %s (stored in %s) is corrupt"),
                    oid_to_hex(repl), p->pack_name);
        obj_read_unlock();
index fb15fc5b49a15ee0ae42ecb22a382914dad9c574..04080a558bfe7265495a22dbab046e05f17f0696 100644 (file)
@@ -1176,14 +1176,14 @@ void mark_bad_packed_object(struct packed_git *p, const struct object_id *oid)
 }
 
 const struct packed_git *has_packed_and_bad(struct repository *r,
-                                           const unsigned char *sha1)
+                                           const struct object_id *oid)
 {
        struct packed_git *p;
        unsigned i;
 
        for (p = r->objects->packed_git; p; p = p->next)
                for (i = 0; i < p->num_bad_objects; i++)
-                       if (hasheq(sha1,
+                       if (hasheq(oid->hash,
                                   p->bad_object_sha1 + the_hash_algo->rawsz * i))
                                return p;
        return NULL;
index a982ed9994036ef63cabc429f50395a0d4ced879..186146779d4aade93bf42cd63dd6e5bcd69e69c8 100644 (file)
@@ -160,7 +160,7 @@ int packed_object_info(struct repository *r,
                       off_t offset, struct object_info *);
 
 void mark_bad_packed_object(struct packed_git *, const struct object_id *);
-const struct packed_git *has_packed_and_bad(struct repository *r, const unsigned char *sha1);
+const struct packed_git *has_packed_and_bad(struct repository *, const struct object_id *);
 
 #define ON_DISK_KEEP_PACKS 1
 #define IN_CORE_KEEP_PACKS 2