aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test
diff options
context:
space:
mode:
authorNed Twigg <ned.twigg@diffplug.com>2016-03-18 03:08:44 -0700
committerMatthias Sohn <matthias.sohn@sap.com>2016-08-31 00:16:23 +0200
commitb67df51203bb0b7a0dda8a8cfe1ddf09493a13f9 (patch)
tree92240fdb331628508bd582628f929fb8500009d9 /org.eclipse.jgit.pgm.test
parent34673f0536ce30305940a1031fde8923952127e8 (diff)
downloadjgit-b67df51203bb0b7a0dda8a8cfe1ddf09493a13f9.tar.gz
jgit-b67df51203bb0b7a0dda8a8cfe1ddf09493a13f9.zip
CLI: implement option -d for deleting tags
Change-Id: I438456b76aefd361384729686271288186d3be3b Signed-off-by: Ned Twigg <ned.twigg@diffplug.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java
index 0fe25f550a..03391a0fb6 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java
@@ -46,6 +46,7 @@ import static org.junit.Assert.assertEquals;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
+import org.eclipse.jgit.lib.Ref;
import org.junit.Before;
import org.junit.Test;
@@ -70,4 +71,26 @@ public class TagTest extends CLIRepositoryTestCase {
assertEquals("fatal: tag 'test' already exists",
executeUnchecked("git tag test")[0]);
}
+
+ @Test
+ public void testTagDelete() throws Exception {
+ git.tag().setName("test").call();
+
+ Ref ref = git.getRepository().getTags().get("test");
+ assertEquals("refs/tags/test", ref.getName());
+
+ assertEquals("", executeUnchecked("git tag -d test")[0]);
+ Ref deletedRef = git.getRepository().getTags().get("test");
+ assertEquals(null, deletedRef);
+ }
+
+ @Test
+ public void testTagDeleteFail() throws Exception {
+ try {
+ assertEquals("fatal: error: tag 'test' not found.",
+ executeUnchecked("git tag -d test")[0]);
+ } catch (Die e) {
+ assertEquals("fatal: error: tag 'test' not found", e.getMessage());
+ }
+ }
}