* [PATCH 1/2] pretty.c: free get_header() return value
@ 2011-10-23 11:51 Nguyễn Thái Ngọc Duy
2011-10-23 11:51 ` [PATCH 2/2] pretty.c: use original commit message if reencoding fails Nguyễn Thái Ngọc Duy
0 siblings, 1 reply; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2011-10-23 11:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
pretty.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/pretty.c b/pretty.c
index f45eb54..375ff7b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1094,7 +1094,6 @@ void format_commit_message(const struct commit *commit,
{
struct format_commit_context context;
static const char utf8[] = "UTF-8";
- const char *enc;
const char *output_enc = pretty_ctx->output_encoding;
memset(&context, 0, sizeof(context));
@@ -1103,10 +1102,10 @@ void format_commit_message(const struct commit *commit,
context.wrap_start = sb->len;
context.message = commit->buffer;
if (output_enc) {
- enc = get_header(commit, "encoding");
- enc = enc ? enc : utf8;
- if (strcmp(enc, output_enc))
+ char *enc = get_header(commit, "encoding");
+ if (strcmp(enc ? enc : utf8, output_enc))
context.message = logmsg_reencode(commit, output_enc);
+ free(enc);
}
strbuf_expand(sb, format, format_commit_item, &context);
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] pretty.c: use original commit message if reencoding fails
2011-10-23 11:51 [PATCH 1/2] pretty.c: free get_header() return value Nguyễn Thái Ngọc Duy
@ 2011-10-23 11:51 ` Nguyễn Thái Ngọc Duy
0 siblings, 0 replies; 2+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2011-10-23 11:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
pretty.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/pretty.c b/pretty.c
index 375ff7b..230fe1c 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1103,8 +1103,11 @@ void format_commit_message(const struct commit *commit,
context.message = commit->buffer;
if (output_enc) {
char *enc = get_header(commit, "encoding");
- if (strcmp(enc ? enc : utf8, output_enc))
+ if (strcmp(enc ? enc : utf8, output_enc)) {
context.message = logmsg_reencode(commit, output_enc);
+ if (!context.message)
+ context.message = commit->buffer;
+ }
free(enc);
}
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-23 11:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-23 11:51 [PATCH 1/2] pretty.c: free get_header() return value Nguyễn Thái Ngọc Duy
2011-10-23 11:51 ` [PATCH 2/2] pretty.c: use original commit message if reencoding fails Nguyễn Thái Ngọc Duy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.