Web lists-archives.com

[PATCH 116/194] packfile: allow has_packed_and_bad to handle arbitrary repositories




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

diff --git a/packfile.c b/packfile.c
index 28453739b2..21ca15b1ce 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1004,12 +1004,12 @@ void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1)
 	p->num_bad_objects++;
 }
 
-const struct packed_git *has_packed_and_bad_the_repository(const unsigned char *sha1)
+const struct packed_git *has_packed_and_bad(struct repository *r, const unsigned char *sha1)
 {
 	struct packed_git *p;
 	unsigned i;
 
-	for (p = the_repository->objects.packed_git; p; p = p->next)
+	for (p = r->objects.packed_git; p; p = p->next)
 		for (i = 0; i < p->num_bad_objects; i++)
 			if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i))
 				return p;
diff --git a/packfile.h b/packfile.h
index b5122d455e..42593940b0 100644
--- a/packfile.h
+++ b/packfile.h
@@ -141,8 +141,7 @@ extern int packed_object_info(struct repository *r,
 
 extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
 
-#define has_packed_and_bad(r, s) has_packed_and_bad_##r(s)
-extern const struct packed_git *has_packed_and_bad_the_repository(const unsigned char *sha1);
+extern const struct packed_git *has_packed_and_bad(struct repository *r, const unsigned char *sha1);
 
 extern int find_pack_entry(struct repository *r,
 			   const unsigned char *sha1,
-- 
2.15.1.433.g936d1b9894.dirty