aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java10
1 files changed, 7 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 87c282d110..a166790a40 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -187,6 +187,8 @@ public class CommitCommand extends GitCommand<RevCommit> {
RevCommit[] p = previousCommit.getParents();
for (int i = 0; i < p.length; i++)
parents.add(0, p[i].getId());
+ if (author == null)
+ author = previousCommit.getAuthorIdent();
} else {
parents.add(0, headId);
}
@@ -471,7 +473,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
private void processOptions(RepositoryState state) throws NoMessageException {
if (committer == null)
committer = new PersonIdent(repo);
- if (author == null)
+ if (author == null && !amend)
author = committer;
// when doing a merge commit parse MERGE_HEAD and MERGE_MSG files
@@ -574,7 +576,8 @@ public class CommitCommand extends GitCommand<RevCommit> {
/**
* Sets the author for this {@code commit}. If no author is explicitly
* specified because this method is never called or called with {@code null}
- * value then the author will be set to the committer.
+ * value then the author will be set to the committer or to the original
+ * author when amending.
*
* @param author
* the author used for the {@code commit}
@@ -589,7 +592,8 @@ public class CommitCommand extends GitCommand<RevCommit> {
/**
* Sets the author for this {@code commit}. If no author is explicitly
* specified because this method is never called or called with {@code null}
- * value then the author will be set to the committer.
+ * value then the author will be set to the committer or to the original
+ * author when amending.
*
* @param name
* the name of the author used for the {@code commit}