From: Kevin Sawicki Date: Wed, 7 Dec 2011 02:02:30 +0000 (-0800) Subject: Set expected old object id to all zeros when head id is null X-Git-Tag: v1.3.0.201202121842-rc4~58^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2539b1ee096266b7fcca64545f93d7c08ab30f53;p=jgit.git Set expected old object id to all zeros when head id is null 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 --- 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 { 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: