sha1_file: add repository argument to open_sha1_file
[gitweb.git] / sha1_file.c
index 80bac890149659847a0129143aa5a3186f92956f..a2ab2b82c3ba10c8bbfefdbc1e1bc0d1c18a60c1 100644 (file)
@@ -896,7 +896,9 @@ static int stat_sha1_file_the_repository(const unsigned char *sha1,
  * Like stat_sha1_file(), but actually open the object and return the
  * descriptor. See the caveats on the "path" parameter above.
  */
-static int open_sha1_file(const unsigned char *sha1, const char **path)
+#define open_sha1_file(r, s, p) open_sha1_file_##r(s, p)
+static int open_sha1_file_the_repository(const unsigned char *sha1,
+                                        const char **path)
 {
        int fd;
        struct alternate_object_database *alt;
@@ -939,7 +941,7 @@ static void *map_sha1_file_1(const char *path,
        if (path)
                fd = git_open(path);
        else
-               fd = open_sha1_file(sha1, &path);
+               fd = open_sha1_file(the_repository, sha1, &path);
        map = NULL;
        if (fd >= 0) {
                struct stat st;