diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-05-22 08:34:53 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-05-22 09:40:54 +0900 |
commit | 1da2ff7242dfc6df4d470e8519bfd8267940791a (patch) | |
tree | c344d0f11664d75afbf4cbc3440aa2cc96b19028 /org.eclipse.jgit.test | |
parent | 4132dc5858f2326d25d6b5c740f62855d3f39554 (diff) | |
download | jgit-1da2ff7242dfc6df4d470e8519bfd8267940791a.tar.gz jgit-1da2ff7242dfc6df4d470e8519bfd8267940791a.zip |
Repository: Deprecate getTags method
Callers should use getRefDatabase().getRefsByPrefix(R_TAGS) instead.
Adjust the tests accordingly.
Bug: 534731
Change-Id: Ib28ae365e42720268996ff46e34cae1745ad545c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java | 17 |
1 files changed, 11 insertions, 6 deletions
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 87098b65f4..3b29a5bbfb 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 @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.api; +import static org.eclipse.jgit.lib.Constants.R_TAGS; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -135,26 +136,30 @@ public class TagCommandTest extends RepositoryTestCase { } } + private List<Ref> getTags() throws Exception { + return db.getRefDatabase().getRefsByPrefix(R_TAGS); + } + @Test public void testDelete() throws Exception { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); Ref tagRef = git.tag().setName("tag").call(); - assertEquals(1, db.getTags().size()); + assertEquals(1, getTags().size()); List<String> deleted = git.tagDelete().setTags(tagRef.getName()) .call(); assertEquals(1, deleted.size()); assertEquals(tagRef.getName(), deleted.get(0)); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); Ref tagRef1 = git.tag().setName("tag1").call(); Ref tagRef2 = git.tag().setName("tag2").call(); - assertEquals(2, db.getTags().size()); + assertEquals(2, getTags().size()); deleted = git.tagDelete().setTags(tagRef1.getName(), tagRef2.getName()) .call(); assertEquals(2, deleted.size()); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); } } @@ -163,13 +168,13 @@ public class TagCommandTest extends RepositoryTestCase { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); Ref tagRef = git.tag().setName("tag").call(); - assertEquals(1, db.getTags().size()); + assertEquals(1, getTags().size()); List<String> deleted = git.tagDelete() .setTags(Repository.shortenRefName(tagRef.getName())).call(); assertEquals(1, deleted.size()); assertEquals(tagRef.getName(), deleted.get(0)); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); } } |