diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2018-04-06 23:58:34 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-04-18 23:33:37 +0200 |
commit | 42e69409d796421bb1353279cfae463b19a43fe9 (patch) | |
tree | de508687a383408f897e7f5c6c24b488def53b6f /org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java | |
parent | cbb2e65dbcf4c4cf9751184f07d5bc4e58bf17e5 (diff) | |
download | jgit-42e69409d796421bb1353279cfae463b19a43fe9.tar.gz jgit-42e69409d796421bb1353279cfae463b19a43fe9.zip |
Handle Gerrit Change-Ids for merge commits
Otherwise successful, non-conflicting merges will never get a
Gerrit Change-Id.
Bug: 358206
Change-Id: I9b599ad01d9f7332200c1d81a1ba6ce5ef990ab5
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index cd50cae4fb..c8a9049e6c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -112,6 +112,8 @@ public class MergeCommand extends GitCommand<MergeResult> { private String message; + private boolean insertChangeId; + private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; /** @@ -392,6 +394,7 @@ public class MergeCommand extends GitCommand<MergeResult> { try (Git git = new Git(getRepository())) { newHeadId = git.commit() .setReflogComment(refLogMessage.toString()) + .setInsertChangeId(insertChangeId) .call().getId(); } mergeStatus = MergeStatus.MERGED; @@ -619,6 +622,23 @@ public class MergeCommand extends GitCommand<MergeResult> { } /** + * If set to true a change id will be inserted into the commit message + * + * An existing change id is not replaced. An initial change id (I000...) + * will be replaced by the change id. + * + * @param insertChangeId + * whether to insert a change id + * @return {@code this} + * @since 5.0 + */ + public MergeCommand setInsertChangeId(boolean insertChangeId) { + checkCallable(); + this.insertChangeId = insertChangeId; + return this; + } + + /** * The progress monitor associated with the diff operation. By default, this * is set to <code>NullProgressMonitor</code> * |