Skip to content

Commit 1fea63e

Browse files
jrngitster
authored andcommitted
sha1_file: allow map_sha1_file_1 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 ec7283e commit 1fea63e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sha1_file.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -929,18 +929,16 @@ static int open_sha1_file(struct repository *r,
929929
* Map the loose object at "path" if it is not NULL, or the path found by
930930
* searching for a loose object named "sha1".
931931
*/
932-
#define map_sha1_file_1(r, p, s, si) map_sha1_file_1_##r(p, s, si)
933-
static void *map_sha1_file_1_the_repository(const char *path,
934-
const unsigned char *sha1,
935-
unsigned long *size)
932+
static void *map_sha1_file_1(struct repository *r, const char *path,
933+
const unsigned char *sha1, unsigned long *size)
936934
{
937935
void *map;
938936
int fd;
939937

940938
if (path)
941939
fd = git_open(path);
942940
else
943-
fd = open_sha1_file(the_repository, sha1, &path);
941+
fd = open_sha1_file(r, sha1, &path);
944942
map = NULL;
945943
if (fd >= 0) {
946944
struct stat st;

0 commit comments

Comments
 (0)