summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTomasz Zarna2012-03-17 20:13:01 (EDT)
committer Chris Aniszczyk2012-03-18 09:08:35 (EDT)
commitc75aa1aed238dd62d6f00958a5fb2cf782349ee1 (patch)
tree420c0ed8a60fbf5472c1c2a8b539b43faed25ef9
parent9bc26efe9dd1346d4318717bbc930bde81e60515 (diff)
downloadjgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.zip
jgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.tar.gz
jgit-c75aa1aed238dd62d6f00958a5fb2cf782349ee1.tar.bz2
LogCommand#setMaxCount affects all commitsrefs/changes/28/5028/4
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.java36
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java2
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 b9af9dc..b9dc426 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 869c0e1..5b264fc 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;
}