]> source.dussan.org Git - jgit.git/commitdiff
Fix CommitCommand amend mode to preserve parent order 53/11553/1
authorShawn Pearce <sop@google.com>
Thu, 28 Mar 2013 17:58:21 +0000 (13:58 -0400)
committerShawn Pearce <sop@google.com>
Thu, 28 Mar 2013 17:58:21 +0000 (13:58 -0400)
Change-Id: I476921ff8dfa6a357932d42ee59340873502b582

org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java

index 056b47d0fd2a328408fc9a1ec8771ce698e4a6c8..26a64ebcfc7390f86e64428d9600d51b089e9f6f 100644 (file)
@@ -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 {