Re: [PATCH v2 06/15] rev-list: make --count work with --objects
Jeff King <peff@peff.net> writes:
Show 23 quoted lines
> On Sun, Feb 16, 2020 at 03:34:13PM -0800, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>>
>> >> > + if (revs->count) {
>> >> > + revs->count_right++;
>> >> > + return;
>> >> > + }
>> >> > +
>> >>
>> >> Hmm. This puzzled me at first. Do you think that it could benefit from a
>> >> comment?
>> >
>> > What would it say (i.e., I'm not sure what confused you)?
>>
>> I think the question reader had was "why *right*?"
>
> Ah. The answer is: because it's not SYMMETRIC_LEFT. ;)
>
> The counting code accumulates there by default when there are no side
> markings, so that's what it will report when there's no left_right or
> cherry_mark (which we know will be the case here, since we die()
> otherwise).Yup.
/*
* The object count is always accumulated in the .count_right
* field for traversal that is not a left-right traversal,
* and cmd_rev_list() made sure that a .count request that
* wants to count non-commit objects, which is handled by
* the show_object() callback, does not ask for .left_right.
*/
Overkill? I dunno.