Merge test will be performed according to {@link #isForceUpdate()}.
This is the same as:
return update(new RevWalk(getRepository()));
624625626627628629630631632633634
RefUpdate rup = repo.updateRef(headName); rup.setExpectedOldObjectId(oldCommit); rup.setNewObjectId(newCommit); rup.setRefLogMessage("Fast-foward from " + oldCommit.name() + " to " + newCommit.name(), false); Result res = rup.update(walk); switch (res) { case FAST_FORWARD: case NO_CHANGE: case FORCED: break;
185186187188189190191192193194195
ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(headId); Result rc = ru.update(); switch (rc) { case NEW: case FAST_FORWARD: { setCallable(false); if (state == RepositoryState.MERGING_RESOLVED) {
144145146147148149150151152153154
String refName = Constants.R_TAGS + newTag.getTag(); RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(forceUpdate); tagRef.setRefLogMessage("tagged " + name, false); Result updateResult = tagRef.update(revWalk); switch (updateResult) { case NEW: case FORCED: return revTag; case LOCK_FAILURE:
398399400401402403404405406407408
protected void createBranch(ObjectId objectId, String branchName) throws IOException { RefUpdate updateRef = db.updateRef(branchName); updateRef.setNewObjectId(objectId); updateRef.update(); } protected void checkoutBranch(String branchName) throws IllegalStateException, IOException { RevWalk walk = new RevWalk(db);
155156157158159160161162163164165
} // Create the destination, logging the rename during the creation. dst.setExpectedOldObjectId(ObjectId.zeroId()); dst.setNewObjectId(objId); if (dst.update(rw) != Result.NEW) { // If we didn't create the destination we have to undo // our work. Put the log back and restore source. if (renameLog(destination, tmp)) renameLog(tmp, source); source.setExpectedOldObjectId(ObjectId.zeroId());
10231024102510261027102810291030103110321033
case UPDATE_NONFASTFORWARD: ru.setForceUpdate(isAllowNonFastForwards()); ru.setExpectedOldObjectId(cmd.getOldId()); ru.setNewObjectId(cmd.getNewId()); ru.setRefLogMessage("push", true); status(cmd, ru.update(walk)); break; } } catch (IOException err) { cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat.format( JGitText.get().lockError, err.getMessage()));
23292330233123322333233423352336233723382339
// set the merge ref to the merge commit RevCommit mergeCommit = revWalk.parseCommit(mergeCommitId); RefUpdate mergeRefUpdate = repository.updateRef(toBranch); mergeRefUpdate.setNewObjectId(mergeCommitId); mergeRefUpdate.setRefLogMessage("commit: " + mergeCommit.getShortMessage(), false); RefUpdate.Result rc = mergeRefUpdate.update(); switch (rc) { case FAST_FORWARD: // successful, clean merge break; default:
11181119112011211122112311241125112611271128
break; } ru.setExpectedOldObjectId(ticketRefId); ru.setNewObjectId(newId); RefUpdate.Result result = ru.update(getRevWalk()); if (result == RefUpdate.Result.LOCK_FAILURE) { sendError("Failed to obtain lock when updating {0}:{1}", repository.name, ref); sendError("Perhaps an administrator should remove {0}/{1}.lock?", getRepository().getDirectory(), ref); return null; }
10511052105310541055105610571058105910601061
641642643644645646647648649650651