mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-01 05:09:50 +01:00
return revision on merge
This commit is contained in:
@@ -23,7 +23,7 @@ class GitFastForwardIfPossible extends GitMergeStrategy {
|
||||
MergeResult fastForwardResult = mergeWithFastForwardOnlyMode();
|
||||
if (fastForwardResult.getMergeStatus().isSuccessful()) {
|
||||
push();
|
||||
return new MergeCommandResult(Collections.emptyList(), "");
|
||||
return new MergeCommandResult(Collections.emptyList(), fastForwardResult.getNewHead().toString());
|
||||
} else {
|
||||
return fallbackMerge.run();
|
||||
}
|
||||
|
||||
@@ -69,6 +69,6 @@ abstract class GitMergeStrategy extends AbstractGitCommand.GitCloneWorker<MergeC
|
||||
|
||||
MergeCommandResult analyseFailure(MergeResult result) {
|
||||
logger.info("could not merge branch {} into {} due to conflict in paths {}", toMerge, target, result.getConflicts().keySet());
|
||||
return MergeCommandResult.failure(result.getConflicts().keySet());
|
||||
return new MergeCommandResult(result.getConflicts().keySet());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.MergeCommand;
|
||||
import org.eclipse.jgit.api.MergeResult;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.api.MergeCommandResult;
|
||||
import org.eclipse.jgit.api.MergeCommand;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@@ -21,7 +21,7 @@ class GitMergeWithSquash extends GitMergeStrategy {
|
||||
|
||||
@Override
|
||||
MergeCommandResult run() throws IOException {
|
||||
MergeCommand mergeCommand = getClone().merge();
|
||||
MergeCommand mergeCommand = getClone().merge();
|
||||
mergeCommand.setSquash(true);
|
||||
MergeResult result = doMergeInClone(mergeCommand);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.MergeResult;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import sonia.scm.ContextEntry;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
@@ -12,6 +13,6 @@ public class GitMerger {
|
||||
if (revCommit.isPresent()) {
|
||||
return revCommit.get().toString().split(" ")[1];
|
||||
}
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity(GitMergeCommit.class, "merge commit failed"), "could not create commit on merge");
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity(GitMerger.class, "merge commit failed"), "could not create commit on merge");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user