From d2ab7a68e4c3f1e619af3576e1443afa2f98cdfd Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 6 Mar 2014 14:32:08 -0500 Subject: [PATCH] Fixed bug in merge: improper use of force and failing on FORCED result --- src/main/java/com/gitblit/utils/JGitUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java index 6f3b0856..c6526c28 100644 --- a/src/main/java/com/gitblit/utils/JGitUtils.java +++ b/src/main/java/com/gitblit/utils/JGitUtils.java @@ -59,8 +59,8 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.RepositoryCache.FileKey; import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.lib.TreeFormatter; -import org.eclipse.jgit.merge.MergeStrategy; -import org.eclipse.jgit.merge.RecursiveMerger; +import org.eclipse.jgit.merge.MergeStrategy; +import org.eclipse.jgit.merge.RecursiveMerger; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevObject; @@ -84,7 +84,7 @@ import org.eclipse.jgit.util.FS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.gitblit.GitBlitException; +import com.gitblit.GitBlitException; import com.gitblit.models.GitNote; import com.gitblit.models.PathModel; import com.gitblit.models.PathModel.PathChangeModel; @@ -2329,11 +2329,11 @@ public class JGitUtils { RefUpdate mergeRefUpdate = repository.updateRef(toBranch); mergeRefUpdate.setNewObjectId(mergeCommitId); mergeRefUpdate.setRefLogMessage("commit: " + mergeCommit.getShortMessage(), false); - RefUpdate.Result rc = mergeRefUpdate.forceUpdate(); + RefUpdate.Result rc = mergeRefUpdate.update(); switch (rc) { case FAST_FORWARD: // successful, clean merge - break; + break; default: throw new GitBlitException(MessageFormat.format("Unexpected result \"{0}\" when merging commit {1} into {2} in {3}", rc.name(), srcTip.getName(), branchTip.getName(), repository.getDirectory())); -- 2.39.5