diff options
| author | Tomasz Zarna | 2012-03-18 00:13:01 +0000 |
|---|---|---|
| committer | Chris Aniszczyk | 2012-03-18 13:08:35 +0000 |
| commit | c75aa1aed238dd62d6f00958a5fb2cf782349ee1 (patch) | |
| tree | 420c0ed8a60fbf5472c1c2a8b539b43faed25ef9 | |
| parent | 9bc26efe9dd1346d4318717bbc930bde81e60515 (diff) | |
| download | jgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.tar.gz jgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.tar.xz jgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.zip | |
LogCommand#setMaxCount affects all commits
Bug: 370132
Change-Id: I9f5ff3640a4f69c0b48c97609728d7672e63e6ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
| -rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java | 36 | ||||
| -rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java | 2 |
2 files changed, 33 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java index b9af9dc608..b9dc4265d0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java @@ -94,11 +94,11 @@ public class LogCommandTest extends RepositoryTestCase { writeTrashFile("Test.txt", "Hello world"); git.add().addFilepattern("Test.txt").call(); commits.add(git.commit().setMessage("commit#1").call()); - writeTrashFile("Test1.txt", "Hello world!"); - git.add().addFilepattern("Test1.txt").call(); + writeTrashFile("Test.txt", "Hello world!"); + git.add().addFilepattern("Test.txt").call(); commits.add(git.commit().setMessage("commit#2").call()); - writeTrashFile("Test2.txt", "Hello world!!"); - git.add().addFilepattern("Test2.txt").call(); + writeTrashFile("Test1.txt", "Hello world!!"); + git.add().addFilepattern("Test1.txt").call(); commits.add(git.commit().setMessage("commit#3").call()); return commits; } @@ -122,6 +122,34 @@ public class LogCommandTest extends RepositoryTestCase { } @Test + public void logPathWithMaxCount() throws Exception { + Git git = Git.wrap(db); + List<RevCommit> commits = createCommits(git); + + Iterator<RevCommit> log = git.log().addPath("Test.txt").setMaxCount(1) + .call().iterator(); + assertTrue(log.hasNext()); + RevCommit commit = log.next(); + assertTrue(commits.contains(commit)); + assertEquals("commit#2", commit.getShortMessage()); + assertFalse(log.hasNext()); + } + + @Test + public void logPathWithSkip() throws Exception { + Git git = Git.wrap(db); + List<RevCommit> commits = createCommits(git); + + Iterator<RevCommit> log = git.log().addPath("Test.txt").setSkip(1) + .call().iterator(); + assertTrue(log.hasNext()); + RevCommit commit = log.next(); + assertTrue(commits.contains(commit)); + assertEquals("commit#1", commit.getShortMessage()); + assertFalse(log.hasNext()); + } + + @Test public void logAllCommitsWithSkip() throws Exception { Git git = Git.wrap(db); List<RevCommit> commits = createCommits(git); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java index 869c0e1d94..5b264fcf3d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java @@ -127,7 +127,7 @@ class StartGenerator extends Generator { else pending = new DateRevQueue(q); if (tf != TreeFilter.ALL) { - rf = AndRevFilter.create(rf, new RewriteTreeFilter(w, tf)); + rf = AndRevFilter.create(new RewriteTreeFilter(w, tf), rf); pendingOutputType |= HAS_REWRITE | NEEDS_REWRITE; } |
