diff options
author | Shawn Pearce <sop@google.com> | 2013-03-28 13:58:21 -0400 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2013-03-28 13:58:21 -0400 |
commit | 1f51aecf95d61e48618d478a693f73dcf1ec1146 (patch) | |
tree | eed49c8a9e6fd592956ee1676b7717a6bbeae770 /org.eclipse.jgit | |
parent | d9d3439617677d75ffde57d2860807fa7c14aff0 (diff) | |
download | jgit-1f51aecf95d61e48618d478a693f73dcf1ec1146.tar.gz jgit-1f51aecf95d61e48618d478a693f73dcf1ec1146.zip |
Fix CommitCommand amend mode to preserve parent order
Change-Id: I476921ff8dfa6a357932d42ee59340873502b582
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index 056b47d0fd..26a64ebcfc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -184,9 +184,8 @@ public class CommitCommand extends GitCommand<RevCommit> { if (amend) { RevCommit previousCommit = new RevWalk(repo) .parseCommit(headId); - RevCommit[] p = previousCommit.getParents(); - for (int i = 0; i < p.length; i++) - parents.add(0, p[i].getId()); + for (RevCommit p : previousCommit.getParents()) + parents.add(p.getId()); if (author == null) author = previousCommit.getAuthorIdent(); } else { |