summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java5
1 files changed, 4 insertions, 1 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 fc56f9af11..14a7494ba6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -228,7 +228,10 @@ public class CommitCommand extends GitCommand<RevCommit> {
ru.setRefLogMessage(
prefix + revCommit.getShortMessage(), false);
}
- ru.setExpectedOldObjectId(headId);
+ if (headId != null)
+ ru.setExpectedOldObjectId(headId);
+ else
+ ru.setExpectedOldObjectId(ObjectId.zeroId());
Result rc = ru.forceUpdate();
switch (rc) {
case NEW: