summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-04-10 17:29:58 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-04-10 17:29:58 -0400
commitad2ffc576b8ba959da02cbab19be14e01c57266b (patch)
tree1be4ca1ecba9c79e448b09d6fa06c95ecfb98ad7 /org.eclipse.jgit.test/tst
parent266ec24d4986253d62b463f8d1a6e5e040d393f7 (diff)
parent2b9c440fd1a08158b5e69d3a9e1a5bed4a17b286 (diff)
downloadjgit-ad2ffc576b8ba959da02cbab19be14e01c57266b.tar.gz
jgit-ad2ffc576b8ba959da02cbab19be14e01c57266b.zip
Merge "LogCommand.all(), peel references before using them"
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java25
1 files changed, 25 insertions, 0 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 1f53645562..c6402e75ea 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
@@ -51,6 +51,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.jgit.junit.RepositoryTestCase;
+import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Test;
@@ -89,6 +90,30 @@ public class LogCommandTest extends RepositoryTestCase {
assertFalse(log.hasNext());
}
+ @Test
+ public void logAllCommitsWithTag() throws Exception {
+ List<RevCommit> commits = new ArrayList<RevCommit>();
+ Git git = Git.wrap(db);
+
+ writeTrashFile("Test.txt", "Hello world");
+ git.add().addFilepattern("Test.txt").call();
+ commits.add(git.commit().setMessage("initial commit").call());
+
+ TagCommand tagCmd = git.tag();
+ tagCmd.setName("tagname");
+ tagCmd.setObjectId(commits.get(0));
+ tagCmd.setTagger(new PersonIdent(db));
+ Ref tag = tagCmd.call();
+
+ Iterator<RevCommit> log = git.log().all().call().iterator();
+ assertTrue(log.hasNext());
+ RevCommit commit = log.next();
+ tag = db.peel(tag);
+
+ assertEquals(commit.getName(), tag.getPeeledObjectId().getName());
+ assertTrue(commits.contains(commit));
+ }
+
private List<RevCommit> createCommits(Git git) throws Exception {
List<RevCommit> commits = new ArrayList<RevCommit>();
writeTrashFile("Test.txt", "Hello world");