Web lists-archives.com

[PATCH 161/194] commit: allow parse_commit_gently to handle arbitrary repository




Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 commit.c | 8 ++++----
 commit.h | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/commit.c b/commit.c
index 67d329e13c..bd9049a9df 100644
--- a/commit.c
+++ b/commit.c
@@ -393,7 +393,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
 	return 0;
 }
 
-int parse_commit_gently_the_repository(struct commit *item, int quiet_on_missing)
+int parse_commit_gently(struct repository *r, struct commit *item, int quiet_on_missing)
 {
 	enum object_type type;
 	void *buffer;
@@ -404,7 +404,7 @@ int parse_commit_gently_the_repository(struct commit *item, int quiet_on_missing
 		return -1;
 	if (item->object.parsed)
 		return 0;
-	buffer = read_sha1_file(the_repository, item->object.oid.hash, &type,
+	buffer = read_sha1_file(r, item->object.oid.hash, &type,
 				&size);
 	if (!buffer)
 		return quiet_on_missing ? -1 :
@@ -415,9 +415,9 @@ int parse_commit_gently_the_repository(struct commit *item, int quiet_on_missing
 		return error("Object %s not a commit",
 			     oid_to_hex(&item->object.oid));
 	}
-	ret = parse_commit_buffer(the_repository, item, buffer, size);
+	ret = parse_commit_buffer(r, item, buffer, size);
 	if (save_commit_buffer && !ret) {
-		set_commit_buffer(the_repository, item, buffer, size);
+		set_commit_buffer(r, item, buffer, size);
 		return 0;
 	}
 	free(buffer);
diff --git a/commit.h b/commit.h
index 8532ddd69c..153f13600b 100644
--- a/commit.h
+++ b/commit.h
@@ -65,8 +65,7 @@ struct commit *lookup_commit_reference_by_name(const char *name);
 struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name);
 
 int parse_commit_buffer(struct repository *r, struct commit *item, const void *buffer, unsigned long size);
-#define parse_commit_gently(r, i, q) parse_commit_gently_##r(i, q)
-int parse_commit_gently_the_repository(struct commit *item, int quiet_on_missing);
+int parse_commit_gently(struct repository *r, struct commit *item, int quiet_on_missing);
 #define parse_commit(r, i) parse_commit_##r(i)
 static inline int parse_commit_the_repository(struct commit *item)
 {
-- 
2.15.1.433.g936d1b9894.dirty