implement requested review changes

This commit is contained in:
Konstantin Schaper
2020-09-18 08:47:04 +02:00
parent 2d024fe210
commit 3e96d89480
2 changed files with 6 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ public class GitMergeRebase extends GitMergeStrategy {
.setUpstream(targetBranch)
.call();
} catch (GitAPIException e) {
throw new InternalRepositoryException(getContext().getRepository(), "could not merge branch " + branchToMerge + " into " + targetBranch, e);
throw new InternalRepositoryException(getContext().getRepository(), "could not rebase branch " + branchToMerge + " onto " + targetBranch, e);
}
if (result.getStatus().isSuccessful()) {
@@ -84,7 +84,6 @@ public class GitMergeRebase extends GitMergeStrategy {
getClone()
.merge()
.setFastForward(MergeCommand.FastForwardMode.FF_ONLY)
.setCommit(false) // we want to set the author manually
.include(branchToMerge, sourceRevision)
.call();
push();

View File

@@ -496,7 +496,7 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
}
@Test
public void shouldRejectRebaseMergeIfBranchCannotBeRebased() {
public void shouldRejectRebaseMergeIfBranchCannotBeRebased() throws IOException, GitAPIException {
GitMergeCommand command = createCommand();
MergeCommandRequest request = new MergeCommandRequest();
request.setTargetBranch("master");
@@ -507,6 +507,10 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
MergeCommandResult mergeCommandResult = command.merge(request);
assertThat(mergeCommandResult.isSuccess()).isFalse();
Repository repository = createContext().open();
Iterable<RevCommit> commits = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
RevCommit headCommit = commits.iterator().next();
assertThat(headCommit.getName()).isEqualTo("fcd0ef1831e4002ac43ea539f4094334c79ea9ec");
}