Set author for merge

This commit is contained in:
René Pfeuffer
2018-11-07 14:02:02 +01:00
parent 2d04e6c2f0
commit 8771f68081
4 changed files with 49 additions and 6 deletions

View File

@@ -71,8 +71,7 @@ public class GitMergeCommand extends AbstractGitCommand implements MergeCommand
MergeResult result;
try {
result = clone.merge()
.setCommit(true)
.setMessage(String.format(MERGE_COMMIT_MESSAGE_TEMPLATE, toMerge, target))
.setCommit(false) // we want to set the author manually
.include(toMerge, resolveRevision(toMerge))
.call();
} catch (GitAPIException e) {
@@ -80,6 +79,14 @@ public class GitMergeCommand extends AbstractGitCommand implements MergeCommand
}
if (result.getMergeStatus().isSuccessful()) {
logger.debug("merged branch {} into {}", toMerge, target);
try {
clone.commit()
.setAuthor(request.getAuthor().getName(), request.getAuthor().getMail())
.setMessage(String.format(MERGE_COMMIT_MESSAGE_TEMPLATE, toMerge, target))
.call();
} catch (GitAPIException e) {
throw new InternalRepositoryException("could not commit merge between branch " + toMerge + " and " + target, e);
}
try {
clone.push().call();
} catch (GitAPIException e) {