Re: [PATCH 1/3] commit-reach: use one walk in remove_redundant()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 31.01.21 um 04:52 schrieb Derrick Stolee:
> On 1/29/2021 12:11 PM, René Scharfe wrote:
>> Am 28.01.21 um 21:51 schrieb Junio C Hamano:
>>> "Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>>>> +	/* clear marks */
>>>> +	for (i = 0; i < cnt; i++) {
>>>> +		struct commit_list *parents;
>>>> +		parents = array[i]->parents;
>>>> +
>>>> +		while (parents) {
>>>> +			clear_commit_marks(parents->item, STALE);
>>>> +			parents = parents->next;
>>>>  		}
>>
>> This loop clears STALE from the parents of both the non-stale and
>> stale entries.  OK.  Should it also clear it from the stale entries
>> themselves?
>
> clear_commit_marks() walks commits starting from the input commit
> (parents->item in this case) and clears the STALE bit as long as
> it is present. This way, the accumulated clear_commit_marks() will
> walk each commit only once _and_ will visit any of the commits from
> 'array' that received the STALE bit during the above walk.

OK, makes sense -- stale items are ancestors of non-stale items.  That
means you don't need to keep them around even for this cleanup loop and
clearing STALE from the parents of the first count_non_stale items
suffices, right?  In that case you don't need to duplicate the array.

René




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux