Add REST API endpoint to delete a tag

Also-by: Paladox none <thomasmulhall410@yahoo.com>
Change-Id: I40f0a2ca40a615aa2bf757171aaf393afd9eb8ad
This commit is contained in:
David Pursehouse
2016-11-30 20:42:33 +09:00
parent 39806f60fe
commit e113216219
8 changed files with 130 additions and 18 deletions

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.project;
import static org.eclipse.jgit.lib.Constants.R_REFS;
import static org.eclipse.jgit.lib.Constants.R_TAGS;
import com.google.common.base.Strings;
@@ -90,18 +89,8 @@ public class CreateTag implements RestModifyView<ProjectResource, TagInput> {
if (input.revision == null) {
input.revision = Constants.HEAD;
}
while (ref.startsWith("/")) {
ref = ref.substring(1);
}
if (ref.startsWith(R_REFS) && !ref.startsWith(R_TAGS)) {
throw new BadRequestException("invalid tag name \"" + ref + "\"");
}
if (!ref.startsWith(R_TAGS)) {
ref = R_TAGS + ref;
}
if (!Repository.isValidRefName(ref)) {
throw new BadRequestException("invalid tag name \"" + ref + "\"");
}
ref = RefUtil.normalizeTagRef(ref);
RefControl refControl = resource.getControl().controlForRef(ref);
try (Repository repo = repoManager.openRepository(resource.getNameKey())) {