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

This commit is contained in:
Matthias Sohn 2011-01-10 09:00:30 -05:00 committed by Code Review
commit 838fdb342b
2 changed files with 10 additions and 0 deletions

View File

@ -114,6 +114,8 @@ public RevCommit call() throws GitAPIException {
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 RevCommit call() throws GitAPIException {
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());

View File

@ -113,6 +113,8 @@ public RevCommit call() throws GitAPIException {
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 RevCommit call() throws GitAPIException {
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());