From 1f51aecf95d61e48618d478a693f73dcf1ec1146 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Thu, 28 Mar 2013 13:58:21 -0400 Subject: [PATCH] Fix CommitCommand amend mode to preserve parent order Change-Id: I476921ff8dfa6a357932d42ee59340873502b582 --- org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java | 5 ++--- 1 file 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 056b47d0f..26a64ebcf 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 RevCommit call() throws GitAPIException, NoHeadException, 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 {