Web lists-archives.com

[PATCH 186/194] pretty: allow logmsg_reencode to handle arbitrary repositories




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

diff --git a/commit.h b/commit.h
index 77e131d15b..7bdc808018 100644
--- a/commit.h
+++ b/commit.h
@@ -129,8 +129,7 @@ void free_commit_list(struct commit_list *list);
 struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
 
 extern int has_non_ascii(const char *text);
-#define logmsg_reencode(r, c, e, o) logmsg_reencode_##r(c, e ,o)
-extern const char *logmsg_reencode_the_repository(const struct commit *commit,
+extern const char *logmsg_reencode(struct repository *r, const struct commit *commit,
 				   char **commit_encoding,
 				   const char *output_encoding);
 extern const char *skip_blank_lines(const char *msg);
diff --git a/pretty.c b/pretty.c
index 30d53369b5..6dce4bb3c0 100644
--- a/pretty.c
+++ b/pretty.c
@@ -595,14 +595,14 @@ static char *replace_encoding_header(char *buf, const char *encoding)
 	return strbuf_detach(&tmp, NULL);
 }
 
-const char *logmsg_reencode_the_repository(const struct commit *commit,
+const char *logmsg_reencode(struct repository *r, const struct commit *commit,
 			    char **commit_encoding,
 			    const char *output_encoding)
 {
 	static const char *utf8 = "UTF-8";
 	const char *use_encoding;
 	char *encoding;
-	const char *msg = get_commit_buffer(the_repository, commit, NULL);
+	const char *msg = get_commit_buffer(r, commit, NULL);
 	char *out;
 
 	if (!output_encoding || !*output_encoding) {
@@ -630,7 +630,7 @@ const char *logmsg_reencode_the_repository(const struct commit *commit,
 		 * the cached copy from get_commit_buffer, we need to duplicate it
 		 * to avoid munging the cached copy.
 		 */
-		if (msg == get_cached_commit_buffer(the_repository, commit, NULL))
+		if (msg == get_cached_commit_buffer(r, commit, NULL))
 			out = xstrdup(msg);
 		else
 			out = (char *)msg;
@@ -644,7 +644,7 @@ const char *logmsg_reencode_the_repository(const struct commit *commit,
 		 */
 		out = reencode_string(msg, output_encoding, use_encoding);
 		if (out)
-			unuse_commit_buffer(the_repository, commit, msg);
+			unuse_commit_buffer(r, commit, msg);
 	}
 
 	/*
-- 
2.15.1.433.g936d1b9894.dirty