From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/6] pretty: remove reencode_commit_message()
Date: Wed, 17 Oct 2012 22:45:23 -0700 [thread overview]
Message-ID: <1350539128-21577-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1350539128-21577-1-git-send-email-gitster@pobox.com>
This function has only two callsites, and is a thin wrapper whose
usefulness is dubious. When the caller needs to learn the log
output encoding, it should be able to do so by directly calling
get_log_output_encoding() and calling the underlying
logmsg_reencode() with it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/blame.c | 5 +++--
commit.h | 2 --
pretty.c | 13 ++-----------
3 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index c27ef21..cfae569 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1425,7 +1425,7 @@ static void get_commit_info(struct commit *commit,
int detailed)
{
int len;
- const char *subject;
+ const char *subject, *encoding;
char *reencoded, *message;
static char author_name[1024];
static char author_mail[1024];
@@ -1446,7 +1446,8 @@ static void get_commit_info(struct commit *commit,
die("Cannot read commit %s",
sha1_to_hex(commit->object.sha1));
}
- reencoded = reencode_commit_message(commit, NULL);
+ encoding = get_log_output_encoding();
+ reencoded = logmsg_reencode(commit, encoding);
message = reencoded ? reencoded : commit->buffer;
ret->author = author_name;
ret->author_mail = author_mail;
diff --git a/commit.h b/commit.h
index 9f21313..a822af8 100644
--- a/commit.h
+++ b/commit.h
@@ -99,8 +99,6 @@ extern int has_non_ascii(const char *text);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
extern char *logmsg_reencode(const struct commit *commit,
const char *output_encoding);
-extern char *reencode_commit_message(const struct commit *commit,
- const char **encoding_p);
extern void get_commit_format(const char *arg, struct rev_info *);
extern const char *format_subject(struct strbuf *sb, const char *msg,
const char *line_separator);
diff --git a/pretty.c b/pretty.c
index 8b1ea9f..c311a68 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1341,16 +1341,6 @@ void pp_remainder(const struct pretty_print_context *pp,
}
}
-char *reencode_commit_message(const struct commit *commit, const char **encoding_p)
-{
- const char *encoding;
-
- encoding = get_log_output_encoding();
- if (encoding_p)
- *encoding_p = encoding;
- return logmsg_reencode(commit, encoding);
-}
-
void pretty_print_commit(const struct pretty_print_context *pp,
const struct commit *commit,
struct strbuf *sb)
@@ -1367,7 +1357,8 @@ void pretty_print_commit(const struct pretty_print_context *pp,
return;
}
- reencoded = reencode_commit_message(commit, &encoding);
+ encoding = get_log_output_encoding();
+ reencoded = logmsg_reencode(commit, encoding);
if (reencoded) {
msg = reencoded;
}
--
1.8.0.rc3.112.gdb88a5e
next prev parent reply other threads:[~2012-10-18 5:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 5:45 [PATCH 0/6] Bring "format-patch --notes" closer to a real feature Junio C Hamano
2012-10-18 5:45 ` Junio C Hamano [this message]
2012-10-18 5:45 ` [PATCH 2/6] format_note(): simplify API Junio C Hamano
2012-10-18 5:45 ` [PATCH 3/6] pretty: prepare notes message at a centralized place Junio C Hamano
2012-10-18 7:49 ` Jeff King
2012-10-18 9:17 ` Junio C Hamano
2012-10-18 9:18 ` Jeff King
2012-10-18 10:00 ` [PATCH] strbuf: always return a non-NULL value from strbuf_detach Jeff King
2012-10-18 5:45 ` [PATCH 4/6] pretty_print_commit(): do not append notes message Junio C Hamano
2012-10-18 5:45 ` [PATCH 5/6] format-patch: append --signature after notes Junio C Hamano
2012-10-18 5:45 ` [PATCH 6/6] format-patch --notes: show notes after three-dashes Junio C Hamano
2012-10-18 21:35 ` Philip Oakley
2012-10-18 22:08 ` Junio C Hamano
2012-10-19 20:06 ` Junio C Hamano
2012-10-21 21:33 ` Philip Oakley
2012-10-18 10:02 ` [PATCH 0/6] Bring "format-patch --notes" closer to a real feature Jeff King
2012-10-18 11:06 ` Nguyen Thai Ngoc Duy
2012-10-18 12:24 ` Michael J Gruber
2012-10-18 17:04 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350539128-21577-2-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).