Skip to content

Commit 720aaa1

Browse files
jrngitster
authored andcommitted
packfile: add repository argument to packed_object_info
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 <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Reviewed-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 144f494 commit 720aaa1

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

builtin/pack-objects.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,8 @@ static void drop_reused_delta(struct object_entry *entry)
15721572

15731573
oi.sizep = &entry->size;
15741574
oi.typep = &entry->type;
1575-
if (packed_object_info(entry->in_pack, entry->in_pack_offset, &oi) < 0) {
1575+
if (packed_object_info(the_repository, entry->in_pack,
1576+
entry->in_pack_offset, &oi) < 0) {
15761577
/*
15771578
* We failed to get the info from this pack for some reason;
15781579
* fall back to sha1_object_info, which may find another copy.

packfile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,8 +1333,8 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
13331333
hashmap_add(&delta_base_cache, ent);
13341334
}
13351335

1336-
int packed_object_info(struct packed_git *p, off_t obj_offset,
1337-
struct object_info *oi)
1336+
int packed_object_info_the_repository(struct packed_git *p, off_t obj_offset,
1337+
struct object_info *oi)
13381338
{
13391339
struct pack_window *w_curs = NULL;
13401340
unsigned long size;

packfile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ extern void release_pack_memory(size_t);
125125
/* global flag to enable extra checks when accessing packed objects */
126126
extern int do_check_packed_object_crc;
127127

128-
extern int packed_object_info(struct packed_git *pack, off_t offset, struct object_info *);
128+
#define packed_object_info(r, p, o, oi) packed_object_info_##r(p, o, oi)
129+
extern int packed_object_info_the_repository(struct packed_git *pack, off_t offset, struct object_info *);
129130

130131
extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
131132
extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ int oid_object_info_extended_the_repository(const struct object_id *oid, struct
13071307
* information below, so return early.
13081308
*/
13091309
return 0;
1310-
rtype = packed_object_info(e.p, e.offset, oi);
1310+
rtype = packed_object_info(the_repository, e.p, e.offset, oi);
13111311
if (rtype < 0) {
13121312
mark_bad_packed_object(e.p, real->hash);
13131313
return oid_object_info_extended(the_repository, real, oi, 0);

0 commit comments

Comments
 (0)