[PATCH 183/194] commit: add repository argument to logmsg_reencode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 builtin/am.c                               | 3 ++-
 builtin/blame.c                            | 2 +-
 builtin/commit.c                           | 2 +-
 builtin/reset.c                            | 3 ++-
 commit.h                                   | 3 ++-
 contrib/coccinelle/submodule_reading.cocci | 9 +++++++++
 pretty.c                                   | 7 ++++---
 revision.c                                 | 2 +-
 sequencer.c                                | 3 ++-
 9 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/builtin/am.c b/builtin/am.c
index 7072ec78cb..9bbf41912b 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1328,7 +1328,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
 	size_t ident_len;
 	struct ident_split id;
 
-	buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
+	buffer = logmsg_reencode(the_repository, commit, NULL,
+				 get_commit_output_encoding());
 
 	ident_line = find_commit_header(buffer, "author", &ident_len);
 
diff --git a/builtin/blame.c b/builtin/blame.c
index 956df42c67..f9c18f6413 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -186,7 +186,7 @@ static void get_commit_info(struct commit *commit,
 	commit_info_init(ret);
 
 	encoding = get_log_output_encoding();
-	message = logmsg_reencode(commit, NULL, encoding);
+	message = logmsg_reencode(the_repository, commit, NULL, encoding);
 	get_ac_line(message, "\nauthor ",
 		    &ret->author, &ret->author_mail,
 		    &ret->author_time, &ret->author_tz);
diff --git a/builtin/commit.c b/builtin/commit.c
index cceb965569..c903893767 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1113,7 +1113,7 @@ static const char *read_commit_message(const char *name)
 	if (!commit)
 		die(_("could not lookup commit %s"), name);
 	out_enc = get_commit_output_encoding();
-	return logmsg_reencode(commit, NULL, out_enc);
+	return logmsg_reencode(the_repository, commit, NULL, out_enc);
 }
 
 /*
diff --git a/builtin/reset.c b/builtin/reset.c
index 7c57309adc..ef16cbea0d 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -111,7 +111,8 @@ static void print_new_head_line(struct commit *commit)
 
 	hex = find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV);
 	printf(_("HEAD is now at %s"), hex);
-	msg = logmsg_reencode(commit, NULL, get_log_output_encoding());
+	msg = logmsg_reencode(the_repository, commit, NULL,
+			      get_log_output_encoding());
 	body = strstr(msg, "\n\n");
 	if (body) {
 		const char *eol;
diff --git a/commit.h b/commit.h
index b9eb079e21..33f7779602 100644
--- a/commit.h
+++ b/commit.h
@@ -130,7 +130,8 @@ 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);
-extern const char *logmsg_reencode(const struct commit *commit,
+#define logmsg_reencode(r, c, e, o) logmsg_reencode_##r(c, e ,o)
+extern const char *logmsg_reencode_the_repository(const struct commit *commit,
 				   char **commit_encoding,
 				   const char *output_encoding);
 extern const char *skip_blank_lines(const char *msg);
diff --git a/contrib/coccinelle/submodule_reading.cocci b/contrib/coccinelle/submodule_reading.cocci
index 17c2e02512..b3e3d88626 100644
--- a/contrib/coccinelle/submodule_reading.cocci
+++ b/contrib/coccinelle/submodule_reading.cocci
@@ -5,3 +5,12 @@ expression F;
  get_commit_buffer(
 +the_repository,
  E, F)
+
+@@
+expression E;
+expression F;
+expression G;
+@@
+ logmsg_reencode(
++the_repository,
+ E, F, G)
diff --git a/pretty.c b/pretty.c
index c5a2f0b018..a0c95280f6 100644
--- a/pretty.c
+++ b/pretty.c
@@ -595,7 +595,7 @@ static char *replace_encoding_header(char *buf, const char *encoding)
 	return strbuf_detach(&tmp, NULL);
 }
 
-const char *logmsg_reencode(const struct commit *commit,
+const char *logmsg_reencode_the_repository(const struct commit *commit,
 			    char **commit_encoding,
 			    const char *output_encoding)
 {
@@ -1519,7 +1519,7 @@ void format_commit_message(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(commit,
+	context.message = logmsg_reencode(the_repository, commit,
 					  &context.commit_encoding,
 					  utf8);
 
@@ -1801,7 +1801,8 @@ void pretty_print_commit(struct pretty_print_context *pp,
 	}
 
 	encoding = get_log_output_encoding();
-	msg = reencoded = logmsg_reencode(commit, NULL, encoding);
+	msg = reencoded = logmsg_reencode(the_repository, commit, NULL,
+					  encoding);
 
 	if (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))
 		indent = 0;
diff --git a/revision.c b/revision.c
index c5d376ba0a..427ccb1fe1 100644
--- a/revision.c
+++ b/revision.c
@@ -3002,7 +3002,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
 	 * in it.
 	 */
 	encoding = get_log_output_encoding();
-	message = logmsg_reencode(commit, NULL, encoding);
+	message = logmsg_reencode(the_repository, commit, NULL, encoding);
 
 	/* Copy the commit to temporary if we are using "fake" headers */
 	if (buf.len)
diff --git a/sequencer.c b/sequencer.c
index 40ba4b6047..57b9ddb69b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -243,7 +243,8 @@ static int get_message(struct commit *commit, struct commit_message *out)
 	const char *abbrev, *subject;
 	int subject_len;
 
-	out->message = logmsg_reencode(commit, NULL, get_commit_output_encoding());
+	out->message = logmsg_reencode(the_repository, commit, NULL,
+				       get_commit_output_encoding());
 	abbrev = short_commit_name(commit);
 
 	subject_len = find_commit_subject(out->message, &subject);
-- 
2.15.1.433.g936d1b9894.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux