Re: [PATCH 2/2] pretty.c: format string with truncate respects logOutputEncoding

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]