diff options
author | Hiroshi Tomita <tomykaira@gmail.com> | 2013-07-01 01:07:10 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-08-21 14:44:47 +0200 |
commit | 27c1c51079e1bd36c82203a6f89d1daa6cbef848 (patch) | |
tree | b3a4081e8b452bbc83c738bdd722014c29cd7ba8 /org.eclipse.jgit | |
parent | 81db591034880fca639b3cd07b10666bdfed650f (diff) | |
download | jgit-27c1c51079e1bd36c82203a6f89d1daa6cbef848.tar.gz jgit-27c1c51079e1bd36c82203a6f89d1daa6cbef848.zip |
Update HEAD in cherry-picking several commits
Without update, index is wrongly detected to be dirty
when picking the second commit.
Change-Id: Idf47ecb33e8bd38340d760806d629f67be92d2d5
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
Bug: 411963
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java | 9 |
1 files changed, 4 insertions, 5 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 d5d9559296..2ebff14f9c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -122,9 +122,8 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { if (headRef == null) throw new NoHeadException( JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported); - RevCommit headCommit = revWalk.parseCommit(headRef.getObjectId()); - newHead = headCommit; + newHead = revWalk.parseCommit(headRef.getObjectId()); // loop through all refs to be cherry-picked for (Ref src : commits) { @@ -156,12 +155,12 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { merger.setBase(srcParent.getTree()); merger.setCommitNames(new String[] { "BASE", ourName, cherryPickName }); - if (merger.merge(headCommit, srcCommit)) { - if (AnyObjectId.equals(headCommit.getTree().getId(), merger + if (merger.merge(newHead, srcCommit)) { + if (AnyObjectId.equals(newHead.getTree().getId(), merger .getResultTreeId())) continue; DirCacheCheckout dco = new DirCacheCheckout(repo, - headCommit.getTree(), repo.lockDirCache(), + newHead.getTree(), repo.lockDirCache(), merger.getResultTreeId()); dco.setFailOnConflict(true); dco.checkout(); |