Skip to content

Commit 0df2378

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packfile.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,9 @@ static const unsigned char *get_delta_base_sha1(struct packed_git *p,
11041104
return NULL;
11051105
}
11061106

1107-
static int retry_bad_packed_offset(struct packed_git *p, off_t obj_offset)
1107+
#define retry_bad_packed_offset(r, p, o) \
1108+
retry_bad_packed_offset_##r(p, o)
1109+
static int retry_bad_packed_offset_the_repository(struct packed_git *p, off_t obj_offset)
11081110
{
11091111
int type;
11101112
struct revindex_entry *revidx;
@@ -1153,7 +1155,7 @@ static enum object_type packed_to_object_type(struct packed_git *p,
11531155
if (type <= OBJ_NONE) {
11541156
/* If getting the base itself fails, we first
11551157
* retry the base, otherwise unwind */
1156-
type = retry_bad_packed_offset(p, base_offset);
1158+
type = retry_bad_packed_offset(the_repository, p, base_offset);
11571159
if (type > OBJ_NONE)
11581160
goto out;
11591161
goto unwind;
@@ -1181,7 +1183,7 @@ static enum object_type packed_to_object_type(struct packed_git *p,
11811183
unwind:
11821184
while (poi_stack_nr) {
11831185
obj_offset = poi_stack[--poi_stack_nr];
1184-
type = retry_bad_packed_offset(p, obj_offset);
1186+
type = retry_bad_packed_offset(the_repository, p, obj_offset);
11851187
if (type > OBJ_NONE)
11861188
goto out;
11871189
}

0 commit comments

Comments
 (0)