git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 18, 2009, 01:40 UTC
Message-ID
<1237340451-31562-5-git-send-email-spearce@spearce.org>
In-Reply-To
<1237340451-31562-4-git-send-email-spearce@spearce.org>

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@spearce.org>
---
 .../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
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 5 of 15 in “Improve test coverage in revwalk”
  1. 00/12 Improve test coverage in revwalkShawn O. Pearce, Mar 18, 2009
  2. 01/12 Fix copyright year in revwalk test file headersShawn O. Pearce, Mar 18, 2009
  3. 02/12 Mark non-overridable methods of RevObject finalShawn O. Pearce, Mar 18, 2009
  4. 03/12 Change RevWalkTestCase to use RevCommit, not ObjectIdShawn O. Pearce, Mar 18, 2009
  5. 04/12 Test that RevFilter.MERGE_BASE cannot use a TreeFilterShawn O. Pearce, Mar 18, 2009
  6. 05/12 Add unit tests for DateRevQueueShawn O. Pearce, Mar 18, 2009
  7. 06/12 Add unit tests for FIFORevQueueShawn O. Pearce, Mar 18, 2009
  8. 07/12 Add unit tests for LIFORevQueueShawn O. Pearce, Mar 18, 2009
  9. 08/12 Add unit tests for AbstractRevQueue.EMPTY_QUEUEShawn O. Pearce, Mar 18, 2009
  10. 09/12 Add tests for basic RevObject methods related to type, flagsShawn O. Pearce, Mar 18, 2009
  11. 10/12 Add tests for ObjectWalkShawn O. Pearce, Mar 18, 2009
  12. 11/12 Add some basic logic tests for TreeFilter on RevWalkShawn O. Pearce, Mar 18, 2009
  13. 12/12 Implement git-core t/t6012-rev-list-simplify test caseShawn O. Pearce, Mar 18, 2009
  14. Robin RosenbergMar 18, 2009
  15. Robin RosenbergMar 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.