Re: [PATCH 3/5] commit-graph: validate layers for generation data
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Feb 1, 2021, 18:10 UTC
- Message-ID
- <a040a680-42ac-66cc-831b-c23a23dd9837@gmail.com>
- In-Reply-To
- <YBg858G1eFy1if6o@nand.local>
On 2/1/2021 12:39 PM, Taylor Blau wrote:
Show 18 quoted lines
> On Mon, Feb 01, 2021 at 05:15:05PM +0000, Derrick Stolee via GitGitGadget wrote:
>> + struct commit_graph *p = g;
>>
>> - if (!g)
>> - return;
>> -
>> - read_generation_data = !!g->chunk_generation_data;
>> + while (read_generation_data && p) {
>> + read_generation_data = p->read_generation_data;
>> + p = p->base_graph;
>> + }
>
> This could probably be guarded with an 'if !read_generation_data', since
> if the previous while loop always read '1' from
> 'p->read_generation_data', then nothing needs updating, no?
>
> (If you do make this change, please don't add '!read_generation_data' to
> the while expression, since it isn't a property of the loop.)True, we could do that. It's enough to add
if (read_generation_data) return 1;
Show 6 quoted lines
>> while (g) {
>> g->read_generation_data = read_generation_data;
>> g = g->base_graph;
>> }
>> +
>> + return read_generation_data;then this becomes
return 0;
Thanks, -Stolee