Skip to content

Commit 4a7c05f

Browse files
jrngitster
authored andcommitted
sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bd27f50 commit 4a7c05f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sha1_file.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,10 +1149,9 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep)
11491149
return parse_sha1_header_extended(hdr, &oi, 0);
11501150
}
11511151

1152-
#define sha1_loose_object_info(r, s, o, f) sha1_loose_object_info_##r(s, o, f)
1153-
static int sha1_loose_object_info_the_repository(const unsigned char *sha1,
1154-
struct object_info *oi,
1155-
int flags)
1152+
static int sha1_loose_object_info(struct repository *r,
1153+
const unsigned char *sha1,
1154+
struct object_info *oi, int flags)
11561155
{
11571156
int status = 0;
11581157
unsigned long mapsize;
@@ -1176,14 +1175,14 @@ static int sha1_loose_object_info_the_repository(const unsigned char *sha1,
11761175
if (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {
11771176
const char *path;
11781177
struct stat st;
1179-
if (stat_sha1_file(the_repository, sha1, &st, &path) < 0)
1178+
if (stat_sha1_file(r, sha1, &st, &path) < 0)
11801179
return -1;
11811180
if (oi->disk_sizep)
11821181
*oi->disk_sizep = st.st_size;
11831182
return 0;
11841183
}
11851184

1186-
map = map_sha1_file(the_repository, sha1, &mapsize);
1185+
map = map_sha1_file(r, sha1, &mapsize);
11871186
if (!map)
11881187
return -1;
11891188

0 commit comments

Comments
 (0)