[JGIT PATCH 04/12] Test that RevFilter.MERGE_BASE cannot use a TreeFilter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only TreeFilter.ALL is permitted right now when computing a merge
base, as the generator pipeline doesn't support parent rewrites
during a merge base computation.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
index fc1a37c..c8fdf5e 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -38,6 +38,7 @@
 package org.spearce.jgit.revwalk;
 
 import org.spearce.jgit.revwalk.filter.RevFilter;
+import org.spearce.jgit.treewalk.filter.TreeFilter;
 
 public class RevWalkMergeBaseTest extends RevWalkTestCase {
 	public void testNone() throws Exception {
@@ -50,6 +51,22 @@ public void testNone() throws Exception {
 		assertNull(rw.next());
 	}
 
+	public void testDisallowTreeFilter() throws Exception {
+		final RevCommit c1 = commit();
+		final RevCommit c2 = commit();
+
+		rw.setRevFilter(RevFilter.MERGE_BASE);
+		rw.setTreeFilter(TreeFilter.ANY_DIFF);
+		markStart(c1);
+		markStart(c2);
+		try {
+			assertNull(rw.next());
+			fail("did not throw IllegalStateException");
+		} catch (IllegalStateException ise) {
+			// expected result
+		}
+	}
+
 	public void testSimple() throws Exception {
 		final RevCommit a = commit();
 		final RevCommit b = commit(a);
-- 
1.6.2.1.286.g8173

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux