From 35eeab41b3eb3fcf6185dd3714c1c5205c5e15c3 Mon Sep 17 00:00:00 2001 From: kylezhao Date: Thu, 12 Aug 2021 19:37:58 +0800 Subject: RevWalk: getMergedInto's result is wrong on the second call Make sure the future user can reset all UNINTERESTING commmits after this operation. Signed-off-by: kylezhao Change-Id: I7549b9ff67bd31acd5dfc92331cb9a30b47b8278 --- .../jgit/revwalk/RevWalkUtilsReachableTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkUtilsReachableTest.java') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkUtilsReachableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkUtilsReachableTest.java index d9ed0c1c63..200cb6a4fe 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkUtilsReachableTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkUtilsReachableTest.java @@ -76,6 +76,28 @@ public class RevWalkUtilsReachableTest extends RevWalkTestCase { } } + @Test + public void findBranchesReachableManyTimes() throws Exception { + /* + * a b + * | | + * c d + */ + RevCommit a = commit(); + RevCommit b = commit(); + RevCommit c = commit(a); + RevCommit d = commit(b); + Ref branchA = branch("a", a); + Ref branchB = branch("b", b); + Ref branchC = branch("c", c); + Ref branchD = branch("d", d); + + assertContains(a, asList(branchA, branchC)); + assertContains(b, asList(branchB, branchD)); + assertContains(c, asList(branchC)); + assertContains(d, asList(branchD)); + } + private Ref branch(String name, RevCommit dst) throws Exception { return Git.wrap(db).branchCreate().setName(name) .setStartPoint(dst.name()).call(); -- cgit v1.2.3