From a80df5380f6f94a8fccaaecac673e3ec9c29bb89 Mon Sep 17 00:00:00 2001 From: Alex Spradlin Date: Tue, 13 Aug 2019 15:20:07 -0700 Subject: RevWalk: Traverse all parents of UNINTERESTING commits When firstParent is set, RevWalk traverses only the first parent of a commit, even though that commit is UNINTERESTING. Since we want the maximal UNINTERESTING set, we shouldn't prune any parents here. This issue is apparent only when some of the commits being traversed are unparsed, since walker.carryFlagsImpl() propagates the UNINTERESTING flag to all parsed ancestors, masking the issue. Therefore teach RevWalk to traverse all parents when a commit is UNINTERESTING and not only the first parent. Since this issue is masked by commit parsing, also test situations when the commits involved are unparsed. Signed-off-by: Alex Spradlin Change-Id: I95e2ad9ae8f1f50fbecae674367ee7e0855519b1 --- org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit/src') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java index 52dd56d129..3990dd6d0e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java @@ -143,7 +143,9 @@ class PendingGenerator extends Generator { for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; - if (firstParent && i > 0) { + // If the commit is uninteresting, don't try to prune + // parents because we want the maximal uninteresting set. + if (firstParent && i > 0 && (c.flags & UNINTERESTING) == 0) { continue; } if ((p.flags & SEEN) != 0) -- cgit v1.2.3