git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Duy Nguyen <pclouds@gmail.com>
Date
May 16, 2014, 13:44 UTC
Message-ID
<CACsJy8B20XMiNqtG9c-cLERd8-zahcvWU=UnY80ZJUmLD91ZKg@mail.gmail.com>
In-Reply-To
<b8aa002298a5e96be3a79406b0d120f001364851.1400242108.git.Alex.Crezoff@gmail.com>
And I thought I was the only one using this :)
Show 26 quoted lines
> 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
Previous: Alexey ShumkinNext: Alexey Shumkin
Message 4 of 25 in “Pretty print truncate does not work”
  1. 0/2 Pretty print truncate does not workAlexey Shumkin, May 16, 2014
  2. 1/2 t4205 (log-pretty-formats): Add failing tests for the case when i18n.logOutputEncoding is setAlexey Shumkin, May 16, 2014
  3. 2/2 pretty.c: format string with truncate respects logOutputEncodingAlexey Shumkin, May 16, 2014
  4. Duy NguyenMay 16, 2014
  5. 0/2 Reroll patch series. Pretty print truncate does not workAlexey Shumkin, May 16, 2014
  6. 1/2 t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is setAlexey Shumkin, May 16, 2014
  7. Junio C HamanoMay 16, 2014
  8. Alexey ShumkinMay 17, 2014
  9. 0/5 Reroll patches. Pretty print truncate does not workAlexey Shumkin, May 19, 2014
  10. 1/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, May 19, 2014
  11. 2/5 t4041, t4205, t6006, t7102: Don't hardcode tested encoding valueAlexey Shumkin, May 19, 2014
  12. brian m. carlsonMay 20, 2014
  13. Alexey ShumkinMay 20, 2014
  14. 3/5 t4205 (log-pretty-format): Use `tformat` rather than `format`Alexey Shumkin, May 19, 2014
  15. 4/5 t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is setAlexey Shumkin, May 19, 2014
  16. 5/5 pretty.c: format string with truncate respects logOutputEncodingAlexey Shumkin, May 19, 2014
  17. 0/5 Reroll patches. Pretty print truncate does not workAlexey Shumkin, May 21, 2014
  18. 1/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, May 21, 2014
  19. 2/5 t4041, t4205, t6006, t7102: Don't hardcode tested encoding valueAlexey Shumkin, May 21, 2014
  20. 3/5 t4205 (log-pretty-format): Use `tformat` rather than `format`Alexey Shumkin, May 21, 2014
  21. 4/5 t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is setAlexey Shumkin, May 21, 2014
  22. Ramsay JonesMay 21, 2014
  23. Junio C HamanoMay 21, 2014
  24. 5/5 pretty.c: format string with truncate respects logOutputEncodingAlexey Shumkin, May 21, 2014
  25. 2/2 pretty.c: format string with truncate respects logOutputEncodingAlexey Shumkin, May 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.