Source:
public RevCommit call() throws NoHeadException, NoMessageException, UnmergedPathException, ConcurrentRefUpdateException, JGitInternalException { checkState(); processOptions(); Ref head; ObjectId parentID; try { head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); switch (ru.update()) { case NEW: case FAST_FORWARD: setState(false); return revCommit; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( "Could lock HEAD during commit"); default: throw new JGitInternalException("Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed"); } } finally { index.unlock(); } } catch (UnmergedPathException e) { throw e; } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of commit command", e); } }

Target:
public RevCommit call() throws NoHeadException, NoMessageException, UnmergedPathException, ConcurrentRefUpdateException, JGitInternalException { checkState(); processOptions(); Ref head; ObjectId parentID; try { head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); Result rc = ru.update(); switch (rc) { case NEW: case FAST_FORWARD: setState(false); return revCommit; case REJECTED: case LOCK_FAILURE: throw new ConcurrentRefUpdateException( "Could lock HEAD during commit", ru.getRef(), rc); default: throw new JGitInternalException( "Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed. ReturnCode from RefUpdate.update() was " + rc); } } finally { index.unlock(); } } catch (UnmergedPathException e) { throw e; } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of commit command", e); } }