Web lists-archives.com

[PATCH 191/194] pretty: allow format_commit_message to handle arbitrary repositories




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

diff --git a/pretty.c b/pretty.c
index 6dce4bb3c0..ed1b778c92 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1503,7 +1503,7 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
 	strbuf_release(&dummy);
 }
 
-void format_commit_message_the_repository(const struct commit *commit,
+void format_commit_message(struct repository *r, const struct commit *commit,
 			   const char *format, struct strbuf *sb,
 			   const struct pretty_print_context *pretty_ctx)
 {
@@ -1519,7 +1519,7 @@ void format_commit_message_the_repository(const struct commit *commit,
 	 * convert a commit message to UTF-8 first
 	 * as far as 'format_commit_item' assumes it in UTF-8
 	 */
-	context.message = logmsg_reencode(the_repository, commit,
+	context.message = logmsg_reencode(r, commit,
 					  &context.commit_encoding,
 					  utf8);
 
@@ -1545,7 +1545,7 @@ void format_commit_message_the_repository(const struct commit *commit,
 	}
 
 	free(context.commit_encoding);
-	unuse_commit_buffer(the_repository, commit, context.message);
+	unuse_commit_buffer(r, commit, context.message);
 }
 
 static void pp_header(struct pretty_print_context *pp,
diff --git a/pretty.h b/pretty.h
index 14af7df4e8..c5fc07005f 100644
--- a/pretty.h
+++ b/pretty.h
@@ -99,9 +99,7 @@ void pp_remainder(struct pretty_print_context *pp, const char **msg_p,
  * Put the result to "sb".
  * Please use this function for custom formats.
  */
-#define format_commit_message(r, c, f, s, p) \
-	format_commit_message_##r(c, f, s, p)
-void format_commit_message_the_repository(const struct commit *commit,
+void format_commit_message(struct repository *r, const struct commit *commit,
 			const char *format, struct strbuf *sb,
 			const struct pretty_print_context *context);
 
-- 
2.15.1.433.g936d1b9894.dirty