Re: [PATCH v3 02/11] revision: parse parent in indegree_walk_step()
- From
Jakub Narębski <jnareb@gmail.com>
- Date
- Aug 18, 2020, 14:18 UTC
- Message-ID
- <85imdgxck6.fsf@gmail.com>
- In-Reply-To
- <e6738672349254c6405f7dde48f612b82af9299f.1597509583.git.gitgitgadget@gmail.com>
"Abhishek Kumar via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> From: Abhishek Kumar <abhishekkumar8222@gmail.com> > > 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.
All right, we need to have commit parsed to have correct value for its generation number.
Show 17 quoted lines
> > Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com> > --- > revision.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/revision.c b/revision.c > index 3dcf689341..ecf757c327 100644 > --- a/revision.c > +++ b/revision.c > @@ -3363,6 +3363,9 @@ static void indegree_walk_step(struct rev_info *revs) > struct commit *parent = p->item; > int *pi = indegree_slab_at(&info->indegree, parent); > > + if (parse_commit_gently(parent, 1) < 0) > + return; > +
All right, this is exactly what is done in this function for commit 'c' taken from indegree_queue, whose parents we process here:
if (parse_commit_gently(c, 1) < 0) return;
> if (*pi) > (*pi)++; > else
Looks good to me.
Best,
-- Jakub Narębski