From e38cf2078d22e2c902a373371382ac8d82268f2d Mon Sep 17 00:00:00 2001 From: Ketan Padegaonkar Date: Mon, 23 May 2011 12:06:52 +0530 Subject: Add ListTagCommand to JGit API Bug: 355246 Change-Id: I11e019f3c19b4340ac7160ac8fcbadd52499d322 Signed-off-by: Chris Aniszczyk --- .../tst/org/eclipse/jgit/api/TagCommandTest.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java index 1db0381d0b..1e8f7fde01 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java @@ -197,4 +197,40 @@ public class TagCommandTest extends RepositoryTestCase { assertEquals(0, deleted.size()); } + @Test + public void testShouldNotBlowUpIfThereAreNoTagsInRepository() + throws Exception { + Git git = new Git(db); + git.add().addFilepattern("*").call(); + git.commit().setMessage("initial commit").call(); + List list = git.tagList().call(); + assertEquals(0, list.size()); + } + + @Test + public void testShouldNotBlowUpIfThereAreNoCommitsInRepository() + throws Exception { + Git git = new Git(db); + List list = git.tagList().call(); + assertEquals(0, list.size()); + } + + @Test + public void testListAllTagsInRepositoryInOrder() throws Exception { + Git git = new Git(db); + git.add().addFilepattern("*").call(); + git.commit().setMessage("initial commit").call(); + + git.tag().setName("v3").call(); + git.tag().setName("v2").call(); + git.tag().setName("v10").call(); + + List list = git.tagList().call(); + + assertEquals(3, list.size()); + assertEquals("v10", list.get(0).getTagName()); + assertEquals("v2", list.get(1).getTagName()); + assertEquals("v3", list.get(2).getTagName()); + } + } -- cgit v1.2.3