diff options
author | Axel Richard <axel.richard@obeo.fr> | 2014-08-29 14:37:09 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-08-30 01:17:24 +0200 |
commit | 46f3007b52a5d12c5a973957128ac38680b20ab8 (patch) | |
tree | c51edac33977b1885f310945a6bba8e8220abdea /org.eclipse.jgit/src/org/eclipse | |
parent | 7b7d033ee1fdd8e81ae2ad7dc9e1ae12cbd9ddfa (diff) | |
download | jgit-46f3007b52a5d12c5a973957128ac38680b20ab8.tar.gz jgit-46f3007b52a5d12c5a973957128ac38680b20ab8.zip |
Handle -m option for Merge command
Set the commit message to be used for the merge commit (in case one is
created)
Bug: 442886
Change-Id: Ie5ecc13822faa366f00b3daa07f74c8441cae195
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java | 23 |
1 files changed, 21 insertions, 2 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 6f0313dfda..0488a418af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2010, Christian Halstrick <christian.halstrick@sap.com> - * Copyright (C) 2010-2012, Stefan Lay <stefan.lay@sap.com> + * Copyright (C) 2010-2014, Stefan Lay <stefan.lay@sap.com> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -104,6 +104,8 @@ public class MergeCommand extends GitCommand<MergeResult> { private FastForwardMode fastForwardMode; + private String message; + /** * The modes available for fast forward merges corresponding to the * <code>--ff</code>, <code>--no-ff</code> and <code>--ff-only</code> @@ -313,7 +315,10 @@ public class MergeCommand extends GitCommand<MergeResult> { } String mergeMessage = ""; //$NON-NLS-1$ if (!squash) { - mergeMessage = new MergeMessageFormatter().format( + if (message != null) + mergeMessage = message; + else + mergeMessage = new MergeMessageFormatter().format( commits, head); repo.writeMergeCommitMsg(mergeMessage); repo.writeMergeHeads(Arrays.asList(ref.getObjectId())); @@ -565,4 +570,18 @@ public class MergeCommand extends GitCommand<MergeResult> { this.commit = Boolean.valueOf(commit); return this; } + + /** + * Set the commit message to be used for the merge commit (in case one is + * created) + * + * @param message + * the message to be used for the merge commit + * @return {@code this} + * @since 3.5 + */ + public MergeCommand setMessage(String message) { + this.message = message; + return this; + } } |