[PATCH 073/194] pack: allow find_pack_entry to handle arbitrary repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 packfile.c | 12 +++++++-----
 packfile.h |  5 +++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/packfile.c b/packfile.c
index 9f7ca8f211..178d2e0ddd 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1839,17 +1839,19 @@ static int fill_pack_entry(const unsigned char *sha1,
  * Iff a pack file contains the object named by sha1, return true and
  * store its location to e.
  */
-int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e)
+int find_pack_entry(struct repository *r,
+		    const unsigned char *sha1,
+		    struct pack_entry *e)
 {
 	struct mru_entry *p;
 
-	prepare_packed_git(the_repository);
-	if (!the_repository->objects.packed_git)
+	prepare_packed_git(r);
+	if (!r->objects.packed_git)
 		return 0;
 
-	for (p = the_repository->objects.packed_git_mru.head; p; p = p->next) {
+	for (p = r->objects.packed_git_mru.head; p; p = p->next) {
 		if (fill_pack_entry(sha1, e, p->item)) {
-			mru_mark(&the_repository->objects.packed_git_mru, p);
+			mru_mark(&r->objects.packed_git_mru, p);
 			return 1;
 		}
 	}
diff --git a/packfile.h b/packfile.h
index 615c58cbac..6d10871d25 100644
--- a/packfile.h
+++ b/packfile.h
@@ -142,8 +142,9 @@ extern int packed_object_info_the_repository(struct packed_git *pack, off_t offs
 extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
 extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
 
-#define find_pack_entry(r, s, e) find_pack_entry_##r(s, e)
-extern int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e);
+extern int find_pack_entry(struct repository *r,
+			   const unsigned char *sha1,
+			   struct pack_entry *e);
 
 extern int has_sha1_pack(const unsigned char *sha1);
 
-- 
2.15.1.433.g936d1b9894.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux