Browse Source

Merge "Do not cherry-pick or revert commit more than once"

stable-0.11
Matthias Sohn 14 years ago committed by Code Review
parent
commit
838fdb342b
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
  2. 5
      org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java

5
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());

5
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());

Loading…
Cancel
Save