Skip to content

Commit 144f494

Browse files
stefanbellergitster
authored andcommitted
packfile: add repository argument to packed_to_object_type
Add a repository argument to allow the callers of packed_to_object_type 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 0df2378 commit 144f494

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packfile.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,13 @@ static int retry_bad_packed_offset_the_repository(struct packed_git *p, off_t ob
11241124

11251125
#define POI_STACK_PREALLOC 64
11261126

1127-
static enum object_type packed_to_object_type(struct packed_git *p,
1128-
off_t obj_offset,
1129-
enum object_type type,
1130-
struct pack_window **w_curs,
1131-
off_t curpos)
1127+
#define packed_to_object_type(r, p, o, t, w, c) \
1128+
packed_to_object_type_##r(p, o, t, w, c)
1129+
static enum object_type packed_to_object_type_the_repository(struct packed_git *p,
1130+
off_t obj_offset,
1131+
enum object_type type,
1132+
struct pack_window **w_curs,
1133+
off_t curpos)
11321134
{
11331135
off_t small_poi_stack[POI_STACK_PREALLOC];
11341136
off_t *poi_stack = small_poi_stack;
@@ -1378,8 +1380,8 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
13781380

13791381
if (oi->typep || oi->type_name) {
13801382
enum object_type ptot;
1381-
ptot = packed_to_object_type(p, obj_offset, type, &w_curs,
1382-
curpos);
1383+
ptot = packed_to_object_type(the_repository, p, obj_offset,
1384+
type, &w_curs, curpos);
13831385
if (oi->typep)
13841386
*oi->typep = ptot;
13851387
if (oi->type_name) {

0 commit comments

Comments
 (0)