Source:
<code>public RevTag call() throws JGitInternalException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { Tag newTag = new Tag(repo); newTag.setTag(name); newTag.setMessage(message); newTag.setAuthor(author); Ref head = repo.getRef(Constants.HEAD); if (head == null) <START> throw new NoHeadException( <END> JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); if (id == null) { id = repo.resolve(Constants.HEAD + "^{commit}"); } newTag.setObjId(id); ObjectInserter inserter = repo.newObjectInserter(); try { ObjectLoader object = repo.open(newTag.getObjId()); newTag.setType(Constants.typeString(object.getType())); ObjectId tagId = inserter.insert(Constants.OBJ_TAG, inserter.format(newTag)); newTag.setTagId(tagId); 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(); switch (updateResult) { case NEW: case FORCED: return revTag; default: throw new JGitInternalException(MessageFormat .format(JGitText.get().updatingRefFailed, Constants.HEAD, newTag.toString(), updateResult)); } } finally { revWalk.release(); } } finally { inserter.release(); } } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfTagCommand, e); } }</code><technical_language>This fail if id == null</technical_language>

Target:
public RevTag call() throws JGitInternalException, ConcurrentRefUpdateException, NoHeadException { checkCallable(); RepositoryState state = repo.getRepositoryState(); processOptions(state); try { Tag newTag = new Tag(repo); newTag.setTag(name); newTag.setMessage(message); newTag.setAuthor(author); if (id == null) { Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( JGitText.get().tagOnRepoWithoutHEADCurrentlyNotSupported); id = repo.resolve(Constants.HEAD + "^{commit}"); } newTag.setObjId(id); ObjectInserter inserter = repo.newObjectInserter(); try { ObjectLoader object = repo.open(newTag.getObjId()); newTag.setType(Constants.typeString(object.getType())); ObjectId tagId = inserter.insert(Constants.OBJ_TAG, inserter.format(newTag)); newTag.setTagId(tagId); 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(); 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); } }