Subject: [PATCH v6 02/11] revision: parse parent in indegree_walk_step()

From: "Abhishek Kumar via GitGitGadget" <[email-masked]>
Date: Sat, 16 Jan 2021 18:11:09 +0000

From: Abhishek Kumar <[email-masked]>

In indegree_walk_step(), we add unvisited parents to the indegree queue.
However, parents are not guaranteed to be parsed. As the indegree queue
sorts by generation number, let's parse parents before inserting them to
ensure the correct priority order.

Signed-off-by: Abhishek Kumar <[email-masked]>
---
 revision.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/revision.c b/revision.c
index 1bb590ece78..be2d828a4cc 100644
--- a/revision.c
+++ b/revision.c
@@ -3397,6 +3397,9 @@ static void indegree_walk_step(struct rev_info *revs)
 		struct commit *parent = p->item;
 		int *pi = indegree_slab_at(&info->indegree, parent);
 
+		if (repo_parse_commit_gently(revs->repo, parent, 1) < 0)
+			return;
+
 		if (*pi)
 			(*pi)++;
 		else
-- 
gitgitgadget