diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java index 2ebff14f9c..1b8441170c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -82,6 +82,8 @@ import org.eclipse.jgit.treewalk.FileTreeIterator; * >Git documentation about cherry-pick</a> */ public class CherryPickCommand extends GitCommand<CherryPickResult> { + private String reflogPrefix = "cherry-pick:"; //$NON-NLS-1$ + private List<Ref> commits = new LinkedList<Ref>(); private String ourCommitName = null; @@ -166,9 +168,8 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { dco.checkout(); newHead = new Git(getRepository()).commit() .setMessage(srcCommit.getFullMessage()) - .setReflogComment( - "cherry-pick: " //$NON-NLS-1$ - + srcCommit.getShortMessage()) + .setReflogComment(reflogPrefix + " " //$NON-NLS-1$ + + srcCommit.getShortMessage()) .setAuthor(srcCommit.getAuthorIdent()).call(); cherryPickedRefs.add(src); } else { @@ -242,6 +243,21 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { return this; } + /** + * Set the prefix to use in the reflog. + * <p> + * This is primarily needed for implementing rebase in terms of + * cherry-picking + * + * @param prefix + * including ":" + * @return {@code this} + */ + public CherryPickCommand setReflogPrefix(final String prefix) { + this.reflogPrefix = prefix; + return this; + } + private String calculateOurName(Ref headRef) { if (ourCommitName != null) return ourCommitName; |