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

Re: git log doesn't allow %x00 in custom format anymore?

From
Jeff King <peff@peff.net>
Date
Oct 7, 2010, 17:50 UTC
Message-ID
<20101007175048.GA18518@sigill.intra.peff.net>
In-Reply-To
<AANLkTimYVNNjhaqUHjoVOV-fQBhcENKn7cyj10qcZ+MW@mail.gmail.com>
On Thu, Oct 07, 2010 at 07:41:01PM +0200, Erik Faye-Lund wrote:
Show 23 quoted lines
> > diff --git a/builtin/rev-list.c b/builtin/rev-list.c
> > index efe9360..3b2dca0 100644
> > --- a/builtin/rev-list.c
> > +++ b/builtin/rev-list.c
> > @@ -147,8 +147,10 @@ static void show_commit(struct commit *commit, void *data)
> >                        }
> >                } else {
> >                        if (revs->commit_format != CMIT_FMT_USERFORMAT ||
> > -                           buf.len)
> > -                               printf("%s%c", buf.buf, info->hdr_termination);
> > +                           buf.len) {
> > +                               fwrite(buf.buf, 1, buf.len, stdout);
> > +                               putchar(info->hdr_termination);
> > +                       }
> >                }
> >                strbuf_release(&buf);
> >        } else {
> 
> This gives me a bit of a deja-vu: 1fb5fdd
> 
> Also, fwriting like that to stdout might be a bit troublesome on
> Windows because the string won't end up going through our
> ANSI-emulation.

I don't know enough about the Windows output code paths to comment on that. But this is almost identical to the fwrite in graph_show_commit that we use for the "rev-list --graph" show path. If there is a fix, it needs to be made to both places.

-Peff
Previous: Erik Faye-LundNext: Matthieu Moy
Message 12 of 19 in “git log doesn't allow %x00 in custom format anymore?”
  1. Kirill LikhodedovOct 7, 2010
  2. Jeff KingOct 7, 2010
  3. Kirill LikhodedovOct 7, 2010
  4. Jeff KingOct 7, 2010
  5. Johannes SixtOct 7, 2010
  6. Kirill LikhodedovOct 7, 2010
  7. Jeff KingOct 7, 2010
  8. Matthieu MoyOct 7, 2010
  9. Drew NorthupOct 7, 2010
  10. Erik Faye-LundOct 7, 2010
  11. Erik Faye-LundOct 7, 2010
  12. Jeff KingOct 7, 2010
  13. Matthieu MoyOct 7, 2010
  14. Jeff KingOct 7, 2010
  15. Erik Faye-LundOct 7, 2010
  16. Jeff KingOct 7, 2010
  17. Erik Faye-LundOct 7, 2010
  18. Jeff KingOct 7, 2010
  19. Erik Faye-LundOct 7, 2010

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.