/** {@inheritDoc} */ @Override public void tag(String name, String message) throws GitException { try (Repository repo = getRepository()) { git(repo).tag().setName(name).setMessage(message).setForceUpdate(true).call(); } catch (GitAPIException e) { throw new GitException(e); } }
@Override protected void run() throws Exception { Git git = new Git(db); if (tagName != null) { TagCommand command = git.tag().setForceUpdate(force) .setMessage(message).setName(tagName); if (object != null) { RevWalk walk = new RevWalk(db); command.setObjectId(walk.parseAny(object)); } try { command.call(); } catch (RefAlreadyExistsException e) { throw die(MessageFormat.format(CLIText.get().tagAlreadyExists, tagName)); } } else { ListTagCommand command = git.tagList(); List<Ref> list = command.call(); for (Ref ref : list) { outw.println(Repository.shortenRefName(ref.getName())); } } } }
Ref tagRef = git.tag().setName( escapedTagName ).setMessage( tagMessage ).setForceUpdate( false ).call();
Ref tagRef = git.tag().setName( escapedTagName ).setMessage( tagMessage ).setForceUpdate( false ).call();