Source:
<code>public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { TagBuilder newTag = new TagBuilder(); newTag.setTag(name); newTag.setMessage(message); newTag.setTagger(tagger); if (id == null) { ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); newTag.setObjectId(objectId, Constants.OBJ_COMMIT); } else { newTag.setObjectId(id); } ObjectInserter inserter = repo.newObjectInserter(); try { ObjectId tagId = inserter.insert(newTag); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { <START> RevTag revTag = revWalk.parseTag(newTag.getTagId()); <END> String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }</code><technical_language>I hate a nit, tagId newTag.getTagId() consistently here? form right here, other form 3 lines setNewObjectId(). nice if tagId</technical_language>

Target:
public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, InvalidTagNameException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { TagBuilder newTag = new TagBuilder(); newTag.setTag(name); newTag.setMessage(message); newTag.setTagger(tagger); if (id == null) { ObjectId objectId = repo.resolve(Constants.HEAD + "^{commit}"); if (objectId == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); newTag.setObjectId(objectId, Constants.OBJ_COMMIT); } else { newTag.setObjectId(id); } ObjectInserter inserter = repo.newObjectInserter(); try { ObjectId tagId = inserter.insert(newTag); inserter.flush(); RevWalk revWalk = new RevWalk(repo); try { RevTag revTag = revWalk.parseTag(newTag.getTagId()); String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, tagRef.getRef(), updateResult); default: throw new JGitInternalException(MessageFormat.format( JGitText.get().updatingRefFailed, refName, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }