aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2011-01-10 09:00:30 -0500
committerCode Review <codereview-daemon@eclipse.org>2011-01-10 09:00:30 -0500
commit838fdb342b7964af2de1b163fffb7b22279e780d (patch)
tree39c7391d4299a6595b635f1733443e295983692d /org.eclipse.jgit
parent05ca0c49f90842da9ad81a0d5a5b91e834648073 (diff)
parent2058f9272b33753c695fb57bf9126371d3ab7cec (diff)
downloadjgit-838fdb342b7964af2de1b163fffb7b22279e780d.tar.gz
jgit-838fdb342b7964af2de1b163fffb7b22279e780d.zip
Merge "Do not cherry-pick or revert commit more than once"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java5
2 files changed, 10 insertions, 0 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 2a57b11ac9..153c10000f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -114,6 +114,8 @@ public class CherryPickCommand extends GitCommand<RevCommit> {
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
RevCommit headCommit = revWalk.parseCommit(headRef.getObjectId());
+ newHead = headCommit;
+
// loop through all refs to be cherry-picked
for (Ref src : commits) {
// get the commit to be cherry-picked
@@ -137,6 +139,9 @@ public class CherryPickCommand extends GitCommand<RevCommit> {
merger.setBase(srcParent.getTree());
if (merger.merge(headCommit, srcCommit)) {
+ if (AnyObjectId.equals(headCommit.getTree().getId(), merger
+ .getResultTreeId()))
+ continue;
DirCacheCheckout dco = new DirCacheCheckout(repo,
headCommit.getTree(), repo.lockDirCache(),
merger.getResultTreeId());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
index 26403edfda..57c69cc08a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -113,6 +113,8 @@ public class RevertCommand extends GitCommand<RevCommit> {
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
RevCommit headCommit = revWalk.parseCommit(headRef.getObjectId());
+ newHead = headCommit;
+
// loop through all refs to be reverted
for (Ref src : commits) {
// get the commit to be reverted
@@ -136,6 +138,9 @@ public class RevertCommand extends GitCommand<RevCommit> {
merger.setBase(srcCommit.getTree());
if (merger.merge(headCommit, srcParent)) {
+ if (AnyObjectId.equals(headCommit.getTree().getId(), merger
+ .getResultTreeId()))
+ continue;
DirCacheCheckout dco = new DirCacheCheckout(repo,
headCommit.getTree(), repo.lockDirCache(),
merger.getResultTreeId());