From: Erik Faye-Lund <kusmabite@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Kirill Likhodedov <Kirill.Likhodedov@jetbrains.com>,
Johannes Sixt <j.sixt@viscovery.net>,
git@vger.kernel.org
Subject: Re: git log doesn't allow %x00 in custom format anymore?
Date: Thu, 7 Oct 2010 19:43:10 +0200 [thread overview]
Message-ID: <AANLkTin7pt6rr-RXVWc6YSir1KHVdTr5r3Ls+61gRGqD@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimYVNNjhaqUHjoVOV-fQBhcENKn7cyj10qcZ+MW@mail.gmail.com>
On Thu, Oct 7, 2010 at 7:41 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> On Thu, Oct 7, 2010 at 7:29 PM, Jeff King <peff@peff.net> wrote:
>> On Thu, Oct 07, 2010 at 07:18:18PM +0400, Kirill Likhodedov wrote:
>>
>>> Thanks for pointing that out.
>>> I confirm that on Mac OS X that happens for rev-list as well.
>>>
>>> # git log --pretty=format:foo%x00bar HEAD -1 | od -c
>>> 0000000 f o o \0 b a r
>>> 0000007
>>>
>>> # git rev-list --pretty=format:foo%x00bar HEAD -1 | od -c
>>> 0000000 c o m m i t 2 3 6 0 1 a 2 c 3
>>> 0000020 e 4 6 4 a 4 4 7 9 f 1 7 7 4 e 3
>>> 0000040 6 e a 5 b 9 5 8 b 4 6 0 5 2 1 \n
>>> 0000060 f o o \n
>>> 0000064
>>
>> Ugh. Even worse, it does print with --graph, which uses a slightly
>> different code path.
>>
>> $ git rev-list --graph -1 --format=foo%x00bar HEAD | cat -A
>> * commit 81d866a6a213d5524ce389369377ba3529461e1b$
>> |\ foo^@bar$
>>
>> I am inclined to call the rev-list behavior a bug, and the fix is
>> probably:
>>
>> 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
>
Never mind that, I'm a bit too tired and got struck with a bit of paranoia :P
next prev parent reply other threads:[~2010-10-07 17:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 11:25 git log doesn't allow %x00 in custom format anymore? Kirill Likhodedov
2010-10-07 14:10 ` Jeff King
2010-10-07 14:35 ` Kirill Likhodedov
2010-10-07 14:46 ` Jeff King
2010-10-07 15:07 ` Johannes Sixt
2010-10-07 15:18 ` Kirill Likhodedov
2010-10-07 17:29 ` Jeff King
2010-10-07 17:40 ` Matthieu Moy
2010-10-07 18:02 ` Drew Northup
2010-10-07 17:41 ` Erik Faye-Lund
2010-10-07 17:43 ` Erik Faye-Lund [this message]
2010-10-07 17:50 ` Jeff King
2010-10-07 17:52 ` Matthieu Moy
2010-10-07 17:53 ` Jeff King
2010-10-07 18:05 ` Erik Faye-Lund
2010-10-07 18:13 ` Jeff King
2010-10-07 18:19 ` Erik Faye-Lund
2010-10-07 18:33 ` Jeff King
2010-10-07 18:37 ` Erik Faye-Lund
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=AANLkTin7pt6rr-RXVWc6YSir1KHVdTr5r3Ls+61gRGqD@mail.gmail.com \
--to=kusmabite@gmail.com \
--cc=Kirill.Likhodedov@jetbrains.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=peff@peff.net \
/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).