summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorKevin Sawicki2011-12-06 21:02:30 (EST)
committer Kevin Sawicki2011-12-06 21:02:30 (EST)
commit2539b1ee096266b7fcca64545f93d7c08ab30f53 (patch)
treeb607dbec8713e0fdbbc1033f68c073685da4f251
parentcd958ba93cd62399da3efdd13eb9ccaa0512a452 (diff)
downloadjgit-2539b1ee096266b7fcca64545f93d7c08ab30f53.zip
jgit-2539b1ee096266b7fcca64545f93d7c08ab30f53.tar.gz
jgit-2539b1ee096266b7fcca64545f93d7c08ab30f53.tar.bz2
Set expected old object id to all zeros when head id is nullrefs/changes/55/4755/2
This will be the case on the initial commit to a repository and the ref update should expect a non-existent ref Change-Id: Iaa06e47e6e8cc4a0281c7683b367d4806dd980ea
-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 fc56f9a..14a7494 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: