git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Alexey Shumkin <alex.crezoff@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] pretty.c: format string with truncate respects logOutputEncoding
Date: Fri, 16 May 2014 20:44:47 +0700	[thread overview]
Message-ID: <CACsJy8B20XMiNqtG9c-cLERd8-zahcvWU=UnY80ZJUmLD91ZKg@mail.gmail.com> (raw)
In-Reply-To: <b8aa002298a5e96be3a79406b0d120f001364851.1400242108.git.Alex.Crezoff@gmail.com>

And I thought I was the only one using this :)

> diff --git a/pretty.c b/pretty.c
> index 6e266dd..7eb43c1 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -1500,16 +1500,19 @@ void format_commit_message(const struct commit *commit,
>                            const struct pretty_print_context *pretty_ctx)
>  {
>         struct format_commit_context context;
> -       const char *output_enc = pretty_ctx->output_encoding;
>         const char *utf8 = "UTF-8";
>
>         memset(&context, 0, sizeof(context));
>         context.commit = commit;
>         context.pretty_ctx = pretty_ctx;
>         context.wrap_start = sb->len;
> +       // 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.commit_encoding,
> -                                         output_enc);
> +                                         utf8);
> +       // then convert to an actual output encoding
> +       const char *output_enc = pretty_ctx->output_encoding;
>
>         strbuf_expand(sb, format, format_commit_item, &context);
>         rewrap_message_tail(sb, &context, 0, 0, 0);

It looks ok except minor issues, use C comment syntax, not C++ and
variable declaration not in the middle of the body.
-- 
Duy

  reply	other threads:[~2014-05-16 13:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 13:06 [PATCH 0/2] Pretty print truncate does not work Alexey Shumkin
2014-05-16 13:06 ` [PATCH 1/2] t4205 (log-pretty-formats): Add failing tests for the case when i18n.logOutputEncoding is set Alexey Shumkin
2014-05-16 13:06 ` [PATCH 2/2] pretty.c: format string with truncate respects logOutputEncoding Alexey Shumkin
2014-05-16 13:44   ` Duy Nguyen [this message]
2014-05-16 15:40     ` [PATCH v2 0/2] Reroll patch series. Pretty print truncate does not work Alexey Shumkin
2014-05-16 15:40     ` [PATCH v2 1/2] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set Alexey Shumkin
2014-05-16 18:49       ` Junio C Hamano
2014-05-17  8:52         ` Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 0/5] Reroll patches. Pretty print truncate does not work Alexey Shumkin
2014-05-21 13:20           ` [PATCH v4 " Alexey Shumkin
2014-05-21 13:20           ` [PATCH v4 1/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2014-05-21 13:20           ` [PATCH v4 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value Alexey Shumkin
2014-05-21 13:20           ` [PATCH v4 3/5] t4205 (log-pretty-format): Use `tformat` rather than `format` Alexey Shumkin
2014-05-21 13:20           ` [PATCH v4 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set Alexey Shumkin
2014-05-21 15:38             ` Ramsay Jones
2014-05-21 18:11               ` Junio C Hamano
2014-05-21 13:20           ` [PATCH v4 5/5] pretty.c: format string with truncate respects logOutputEncoding Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 1/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value Alexey Shumkin
2014-05-20  1:49           ` brian m. carlson
2014-05-20  6:41             ` Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 3/5] t4205 (log-pretty-format): Use `tformat` rather than `format` Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set Alexey Shumkin
2014-05-19 15:28         ` [PATCH v3 5/5] pretty.c: format string with truncate respects logOutputEncoding Alexey Shumkin
2014-05-16 15:40     ` [PATCH v2 2/2] " Alexey Shumkin

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='CACsJy8B20XMiNqtG9c-cLERd8-zahcvWU=UnY80ZJUmLD91ZKg@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=alex.crezoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).