From: Jeff King <peff@peff.net>
To: ZheNing Hu <adlternative@gmail.com>
Cc: ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>,
Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Christian Couder <christian.couder@gmail.com>,
Hariom Verma <hariom18599@gmail.com>
Subject: Re: [PATCH] [GSOC] cat-file: fix --batch report changed-type bug
Date: Mon, 31 May 2021 10:44:33 -0400 [thread overview]
Message-ID: <YLT2UfCZyQIXWIOv@coredump.intra.peff.net> (raw)
In-Reply-To: <CAOLTT8Q0zbxh8X03ZmgAzHadTbE4-Af+AB3POOUF2n22u8RExw@mail.gmail.com>
On Mon, May 31, 2021 at 09:20:34PM +0800, ZheNing Hu wrote:
> > But I think we'd want to solve it by swapping the two conditionals I
> > showed above, which restores the assumption made in print_object_or_die().
>
> This method is correct. This will ensure that skip_object_info will not
> be set when print_contents is set.
OK, good, it sounds like we are on the same page. :)
> By the way, maybe we can merge this two "if (opt->all_objects)" block to one.
> [...]
Yes, I think that would make sense to do. It might be worth doing as a
separate patch on top of the bug-fix, though, to make it clear that it's
just cosmetic and separate from the bug-fix.
> > > +test_expect_success 'cat-file --batch="batman" with --batch-all-objects will work' '
> > > + git -C all-two cat-file --batch-all-objects --batch="%(objectname)" | wc -l >expect &&
> > > + git -C all-two cat-file --batch-all-objects --batch="batman" | wc -l >actual &&
> > > + test_cmp expect actual
> > > +'
> >
> > Is it worth testing both of these? The %(objectname) one will fail in
> > the same way (because we do not need to run oid_object_info() to get the
> > oid, which we already have). I'm OK doing both for better coverage, but
> > it may be worth mentioning either in a comment or in the commit message
> > that we expect both to fail, and why.
>
> Yes, these damages need to be pointed out in the commit message.
I think what confused me here is that you are using "%(objectname)" as
the "expect" output, but it also exhibits the bug. So I'd expect this
test to pass even before your patch (though I didn't try it).
Really, the symptom of the bug is that _neither_ of those cat-file
invocations will exit with a success code. But because they're on the
left-hand side of a pipe, we wouldn't even notice.
The simplest test is just:
git -C all-two cat-file --batch-all-objects --batch="%(objectname)" >/dev/null
which will currently fail. It would be nice to verify that its output is
sensible, but I'm not sure how to easily do that (it will spew a bunch
of binary tree data, and it cannot even be parsed reliably since we
haven't output the sizes).
-Peff
next prev parent reply other threads:[~2021-05-31 14:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-30 8:29 [PATCH] [GSOC] cat-file: fix --batch report changed-type bug ZheNing Hu via GitGitGadget
2021-05-30 21:09 ` Jeff King
2021-05-31 13:20 ` ZheNing Hu
2021-05-31 14:44 ` Jeff King [this message]
2021-05-31 15:32 ` ZheNing Hu
2021-05-31 16:07 ` Felipe Contreras
2021-06-01 1:49 ` Jeff King
2021-06-01 6:34 ` Felipe Contreras
2021-06-01 15:34 ` Jeff King
2021-06-01 16:42 ` Felipe Contreras
2021-06-01 12:46 ` ZheNing Hu
2021-05-30 21:15 ` Junio C Hamano
2021-05-30 21:36 ` Jeff King
2021-06-01 1:40 ` Junio C Hamano
2021-05-31 13:55 ` ZheNing Hu
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=YLT2UfCZyQIXWIOv@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=adlternative@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=hariom18599@gmail.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).