summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-04-25 18:21:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-26 01:54:27 (GMT)
commit5da6534dd6ef72970989aa5a4194e13e6a587bd6 (patch)
tree618d9ee6d3a57a333b49516f6a14d7e7cae4c603 /packfile.c
parent720aaa1a74a8cf5fcc35bb294013d30d218bec01 (diff)
downloadgit-5da6534dd6ef72970989aa5a4194e13e6a587bd6.zip
git-5da6534dd6ef72970989aa5a4194e13e6a587bd6.tar.gz
git-5da6534dd6ef72970989aa5a4194e13e6a587bd6.tar.bz2
packfile: add repository argument to read_object
Add a repository argument to allow the callers of read_object to be more specific about which repository to act on. 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: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/packfile.c b/packfile.c
index 5fa7d27..2876e04 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1469,8 +1469,10 @@ struct unpack_entry_stack_ent {
unsigned long size;
};
-static void *read_object(const struct object_id *oid, enum object_type *type,
- unsigned long *size)
+#define read_object(r, o, t, s) read_object_##r(o, t, s)
+static void *read_object_the_repository(const struct object_id *oid,
+ enum object_type *type,
+ unsigned long *size)
{
struct object_info oi = OBJECT_INFO_INIT;
void *content;
@@ -1614,7 +1616,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
oid_to_hex(&base_oid), (uintmax_t)obj_offset,
p->pack_name);
mark_bad_packed_object(p, base_oid.hash);
- base = read_object(&base_oid, &type, &base_size);
+ base = read_object(the_repository, &base_oid, &type, &base_size);
external_base = base;
}
}