Allow use theirs merge strategy to snap back to previous commit
Normally, merge an merged commit is not allowed. However, there is a special case that user want to snap back to an older commit but keep the history. The way to do this is using `theirs` merge strategy to create a merge change. Change-Id: I93fbd7157c6f723d79728c7a8c95f3034b762716
This commit is contained in:
@@ -213,7 +213,8 @@ public class MergeUtil {
|
||||
PersonIdent committerIndent, String commitMsg, RevWalk rw)
|
||||
throws IOException, MergeIdenticalTreeException, MergeConflictException {
|
||||
|
||||
if (rw.isMergedInto(originalCommit, mergeTip)) {
|
||||
if (!MergeStrategy.THEIRS.getName().equals(mergeStrategy) &&
|
||||
rw.isMergedInto(originalCommit, mergeTip)) {
|
||||
throw new ChangeAlreadyMergedException(
|
||||
"'" + originalCommit.getName() + "' has already been merged");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user