Merge test will be performed according to {@link #isForceUpdate()}.
This is the same as:
return update(new RevWalk(getRepository()));
23752376237723782379238023812382238323842385
// 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:
333334335336337338339340341342343
// set the master branch RevCommit revCommit = revWalk.parseCommit(commitId); RefUpdate masterRef = db.updateRef(Constants.R_MASTER); masterRef.setNewObjectId(commitId); masterRef.setRefLogMessage("commit: " + revCommit.getShortMessage(), false); Result masterRC = masterRef.update(); switch (masterRC) { case NEW: success = true; break; default:
347348349350351352353354355356357
if (addGitFlow) { // set the develop branch for git-flow RefUpdate developRef = db.updateRef(Constants.R_DEVELOP); developRef.setNewObjectId(commitId); developRef.setRefLogMessage("commit: " + revCommit.getShortMessage(), false); Result developRC = developRef.update(); switch (developRC) { case NEW: success = true; break; default:
12121213121412151216121712181219122012211222
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; }
7778798081828384858687
RevCommit commit = git.commit().setMessage("create file").call(); RefUpdate update = db.updateRef(Constants.R_STASH); update.setNewObjectId(commit); update.disableRefLog(); assertEquals(Result.NEW, update.update()); StashListCommand command = Git.wrap(db).stashList(); Collection<RevCommit> stashed = command.call(); assertNotNull(stashed); assertTrue(stashed.isEmpty());
949596979899100101102103104
git.add().addFilepattern("file.txt").call(); RevCommit commit = git.commit().setMessage("create file").call(); RefUpdate update = db.updateRef(Constants.R_STASH); update.setNewObjectId(commit); assertEquals(Result.NEW, update.update()); StashListCommand command = git.stashList(); Collection<RevCommit> stashed = command.call(); assertNotNull(stashed); assertEquals(1, stashed.size());
117118119120121122123124125126127
git.add().addFilepattern("file.txt").call(); RevCommit commit2 = git.commit().setMessage("edit file").call(); RefUpdate create = db.updateRef(Constants.R_STASH); create.setNewObjectId(commit1); assertEquals(Result.NEW, create.update()); RefUpdate update = db.updateRef(Constants.R_STASH); update.setNewObjectId(commit2); assertEquals(Result.FAST_FORWARD, update.update());
121122123124125126127128129130131
create.setNewObjectId(commit1); assertEquals(Result.NEW, create.update()); RefUpdate update = db.updateRef(Constants.R_STASH); update.setNewObjectId(commit2); assertEquals(Result.FAST_FORWARD, update.update()); StashListCommand command = git.stashList(); Collection<RevCommit> stashed = command.call(); assertNotNull(stashed); assertEquals(2, stashed.size());
330331332333334335336337338339340
case UPDATE_NONFASTFORWARD: ru.setForceUpdate(rp.isAllowNonFastForwards()); ru.setExpectedOldObjectId(getOldId()); ru.setNewObjectId(getNewId()); ru.setRefLogMessage("push", true); //$NON-NLS-1$ setResult(ru.update(rp.getRevWalk())); break; } } catch (IOException err) { reject(err); }
979899100101102103104105106107
secondCommit = git.commit().setMessage("Second commit").call(); // create a master branch RefUpdate rup = db.updateRef("refs/heads/master"); rup.setNewObjectId(initialCommit.getId()); rup.setForceUpdate(true); rup.update(); } private Git setUpRepoWithRemote() throws Exception { Repository remoteRepository = createWorkRepository(); Git remoteGit = new Git(remoteRepository);