]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: add repository argument to packed_object_info
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 25 Apr 2018 18:21:02 +0000 (11:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Apr 2018 01:54:27 +0000 (10:54 +0900)
Add a repository argument to allow callers of packed_object_info to be
more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
packfile.c
packfile.h
sha1_file.c

index 8d4111f748cad1896556c070f961ca97896f0b8b..d65eb4a94781d7b86b42af05f89df058a2773787 100644 (file)
@@ -1572,7 +1572,8 @@ static void drop_reused_delta(struct object_entry *entry)
 
        oi.sizep = &entry->size;
        oi.typep = &entry->type;
-       if (packed_object_info(entry->in_pack, entry->in_pack_offset, &oi) < 0) {
+       if (packed_object_info(the_repository, entry->in_pack,
+                              entry->in_pack_offset, &oi) < 0) {
                /*
                 * We failed to get the info from this pack for some reason;
                 * fall back to sha1_object_info, which may find another copy.
index 3ecfba66af6b006fa7fec818f8c7ac974bb19107..5fa7d27d3b6659964a7c15e54a9a9e2047e909b3 100644 (file)
@@ -1333,8 +1333,8 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
        hashmap_add(&delta_base_cache, ent);
 }
 
-int packed_object_info(struct packed_git *p, off_t obj_offset,
-                      struct object_info *oi)
+int packed_object_info_the_repository(struct packed_git *p, off_t obj_offset,
+                                     struct object_info *oi)
 {
        struct pack_window *w_curs = NULL;
        unsigned long size;
index a92c0b241cfa65066ab57995f0f902ddb79a3be4..bc8d840b1b80553e26f9a677285d7024de0b7c0e 100644 (file)
@@ -125,7 +125,8 @@ extern void release_pack_memory(size_t);
 /* global flag to enable extra checks when accessing packed objects */
 extern int do_check_packed_object_crc;
 
-extern int packed_object_info(struct packed_git *pack, off_t offset, struct object_info *);
+#define packed_object_info(r, p, o, oi) packed_object_info_##r(p, o, oi)
+extern int packed_object_info_the_repository(struct packed_git *pack, off_t offset, struct object_info *);
 
 extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
 extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
index 93f25c6c6a40d7bb7735ccc184ae3305697938cf..746ff8297a502c5c51dbd2a00e2c34e3bb387fe3 100644 (file)
@@ -1307,7 +1307,7 @@ int oid_object_info_extended_the_repository(const struct object_id *oid, struct
                 * information below, so return early.
                 */
                return 0;
-       rtype = packed_object_info(e.p, e.offset, oi);
+       rtype = packed_object_info(the_repository, e.p, e.offset, oi);
        if (rtype < 0) {
                mark_bad_packed_object(e.p, real->hash);
                return oid_object_info_extended(the_repository, real, oi, 0);