refs: allow for_each_replace_ref to handle arbitrary repositories
[gitweb.git] / sha1_file.c
index aab3b58e0330531efa8a442eafb18840b1f212f3..64a5bd7d8788d7e94e28a70dcb34f35756234920 100644 (file)
@@ -23,6 +23,7 @@
 #include "sha1-lookup.h"
 #include "bulk-checkin.h"
 #include "repository.h"
+#include "replace-object.h"
 #include "streaming.h"
 #include "dir.h"
 #include "list.h"
@@ -1239,7 +1240,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
        int already_retried = 0;
 
        if (flags & OBJECT_INFO_LOOKUP_REPLACE)
-               real = lookup_replace_object(oid);
+               real = lookup_replace_object(the_repository, oid);
 
        if (is_null_oid(real))
                return -1;
@@ -1268,7 +1269,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
        }
 
        while (1) {
-               if (find_pack_entry(real->hash, &e))
+               if (find_pack_entry(the_repository, real->hash, &e))
                        break;
 
                if (flags & OBJECT_INFO_IGNORE_LOOSE)
@@ -1280,8 +1281,8 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
 
                /* Not a loose object; someone else may have just packed it. */
                if (!(flags & OBJECT_INFO_QUICK)) {
-                       reprepare_packed_git();
-                       if (find_pack_entry(real->hash, &e))
+                       reprepare_packed_git(the_repository);
+                       if (find_pack_entry(the_repository, real->hash, &e))
                                break;
                }
 
@@ -1383,8 +1384,8 @@ void *read_object_file_extended(const struct object_id *oid,
        const struct packed_git *p;
        const char *path;
        struct stat st;
-       const struct object_id *repl = lookup_replace ? lookup_replace_object(oid)
-                                                     : oid;
+       const struct object_id *repl = lookup_replace ?
+               lookup_replace_object(the_repository, oid) : oid;
 
        errno = 0;
        data = read_object(repl->hash, type, size);
@@ -1669,7 +1670,7 @@ static int freshen_loose_object(const unsigned char *sha1)
 static int freshen_packed_object(const unsigned char *sha1)
 {
        struct pack_entry e;
-       if (!find_pack_entry(sha1, &e))
+       if (!find_pack_entry(the_repository, sha1, &e))
                return 0;
        if (e.p->freshened)
                return 1;