diff options
author | Tomasz Zarna <tomasz.zarna@tasktop.com> | 2012-11-11 23:38:44 +0100 |
---|---|---|
committer | Chris Aniszczyk <zx@twitter.com> | 2012-11-15 16:28:02 -0800 |
commit | cb0f0ad4cfe2733ff09c2ce4d3b72265ccfee281 (patch) | |
tree | 7ad383723b37911c725ff8569960325efee9affd /org.eclipse.jgit | |
parent | 790126c1457fba6c85680dc7858b4c84e84ea640 (diff) | |
download | jgit-cb0f0ad4cfe2733ff09c2ce4d3b72265ccfee281.tar.gz jgit-cb0f0ad4cfe2733ff09c2ce4d3b72265ccfee281.zip |
Add a test for org.eclipse.jgit.pgm.Tag
The test checks if an error is thrown when trying to create the same tag
for the second time.
Change-Id: I4ed2f6c997587f0ea23bd26a32fb64a2d48a980e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit')
3 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 8a0ce87ee1..8018ab9baa 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -451,6 +451,7 @@ submoduleParentRemoteUrlInvalid=Cannot remove segment from remote url ''{0}'' submodulesNotSupported=Submodules are not supported symlinkCannotBeWrittenAsTheLinkTarget=Symlink "{0}" cannot be written as the link target cannot be read from within Java. systemConfigFileInvalid=Systen wide config file {0} is invalid {1} +tagAlreadyExists=tag ''{0}'' already exists tagNameInvalid=tag name {0} is invalid tagOnRepoWithoutHEADCurrentlyNotSupported=Tag on repository without HEAD currently not supported theFactoryMustNotBeNull=The factory must not be null diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java index cef9e18349..8d887e3548 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/TagCommand.java @@ -50,6 +50,7 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidTagNameException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.api.errors.NoHeadException; +import org.eclipse.jgit.api.errors.RefAlreadyExistsException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; @@ -151,6 +152,11 @@ public class TagCommand extends GitCommand<Ref> { throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); + case REJECTED: + throw new RefAlreadyExistsException( + MessageFormat.format( + JGitText.get().tagAlreadyExists, + newTag.toString())); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index ef4f3b4419..f6c48c92c6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -511,6 +511,7 @@ public class JGitText extends TranslationBundle { /***/ public String submoduleParentRemoteUrlInvalid; /***/ public String symlinkCannotBeWrittenAsTheLinkTarget; /***/ public String systemConfigFileInvalid; + /***/ public String tagAlreadyExists; /***/ public String tagNameInvalid; /***/ public String tagOnRepoWithoutHEADCurrentlyNotSupported; /***/ public String theFactoryMustNotBeNull; |