Thread (130 messages) flat view 130 messages, 5 authors, 2018-03-26
STALE3105d

[PATCH 43/44] packfile: allow find_pack_entry to handle arbitrary repositories

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2018-03-03 11:40:23
Subsystem: the rest · Maintainer: Linus Torvalds

From: Stefan Beller <redacted>

Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 packfile.c | 11 +++++------
 packfile.h |  3 +--
 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/packfile.c b/packfile.c
index 7388debbb2..bafe81544d 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1844,19 +1844,18 @@ static int fill_pack_entry(const unsigned char *sha1,
 	return 1;
 }
 
-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 list_head *pos;
 
-	prepare_packed_git(the_repository);
-	if (!the_repository->objects.packed_git)
+	prepare_packed_git(r);
+	if (!r->objects.packed_git)
 		return 0;
 
-	list_for_each(pos, &the_repository->objects.packed_git_mru) {
+	list_for_each(pos, &r->objects.packed_git_mru) {
 		struct packed_git *p = list_entry(pos, struct packed_git, mru);
 		if (fill_pack_entry(sha1, e, p)) {
-			list_move(&p->mru,
-				  &the_repository->objects.packed_git_mru);
+			list_move(&p->mru, &r->objects.packed_git_mru);
 			return 1;
 		}
 	}
diff --git a/packfile.h b/packfile.h
index e68f790ea7..fe1a6380e6 100644
--- a/packfile.h
+++ b/packfile.h
@@ -127,8 +127,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
  * Iff a pack file in the given repository contains the object named by sha1,
  * return true and store its location to e.
  */
-#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.16.1.435.g8f24da2e1a
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help