summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkMergeBaseTest.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkMergeBaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkMergeBaseTest.java
index b5d4909f39..2451c50f6f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -146,4 +146,29 @@ public class RevWalkMergeBaseTest extends RevWalkTestCase {
assertCommit(b, rw.next());
assertNull(rw.next());
}
-}
+
+ @Test
+ public void testInconsistentCommitTimes() throws Exception {
+ // When commit times are inconsistent (a parent is younger than a child)
+ // make sure that not both, parent and child, are reported as merge
+ // base. In the following repo the merge base between C,D should be B.
+ // But when A is younger than B the MergeBaseGenerator used to generate
+ // A before it detected that B is also a merge base.
+ //
+ // +---C
+ // / /
+ // A---B---D
+
+ final RevCommit a = commit(2);
+ final RevCommit b = commit(-1, a);
+ final RevCommit c = commit(2, b, a);
+ final RevCommit d = commit(1, b);
+
+ rw.setRevFilter(RevFilter.MERGE_BASE);
+ markStart(d);
+ markStart(c);
+ assertCommit(b, rw.next());
+ assertNull(rw.next());
+ }
+
+} \ No newline at end of file