Thread (27 messages) flat view 27 messages, 7 authors, 2021-02-11

Re: [PATCH 3/5] commit-graph: validate layers for generation data

From: Derrick Stolee <hidden>
Date: 2021-02-01 18:11:32

On 2/1/2021 12:39 PM, Taylor Blau wrote:
On Mon, Feb 01, 2021 at 05:15:05PM +0000, Derrick Stolee via GitGitGadget wrote:
quoted
+	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;
quoted
 	while (g) {
 		g->read_generation_data = read_generation_data;
 		g = g->base_graph;
 	}
+
+	return read_generation_data;
then this becomes

	return 0;

Thanks,
-Stolee
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help