diff options
author | Matthias Sohn | 2010-12-05 13:42:39 +0000 |
---|---|---|
committer | Matthias Sohn | 2010-12-05 13:42:39 +0000 |
commit | 9f97033c002cf829924e1c694a1fb0e57d80974e (patch) | |
tree | 7aca7afcf9b5acc6973805816747571dc6b5d464 | |
parent | 3a832b97c65258b3cfe724bf3fec7bfcc1a35e0b (diff) | |
download | egit-9f97033c002cf829924e1c694a1fb0e57d80974e.tar.gz egit-9f97033c002cf829924e1c694a1fb0e57d80974e.tar.xz egit-9f97033c002cf829924e1c694a1fb0e57d80974e.zip |
Adapt to incompatible jgit change Idc5f097d
The jgit change Idc5f097d removed the result id from CommitBuilder,
TagBuilder, hence we obtain the object id from ObjectInserter now.
Depends on jgit change Idc5f097d
Change-Id: I621645a60b0b178fc72f7e3d6785bfe3458c7c3d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
cc: Shawn Pearce <spearce@spearce.org>
-rw-r--r-- | org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java | 10 | ||||
-rw-r--r-- | org.eclipse.egit.core/src/org/eclipse/egit/core/op/TagOperation.java | 14 |
2 files changed, 13 insertions, 11 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java index 2f80547343..1659fcf79b 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java @@ -323,27 +323,27 @@ public class CommitOperation implements IEGitOperation { commit.setTreeId(tree.getTreeId()); commit.setParentIds(parentIds); commit.setMessage(commitMessage); - commit - .setAuthor(new PersonIdent(authorIdent, commitDate, + commit.setAuthor(new PersonIdent(authorIdent, commitDate, timeZone)); commit.setCommitter(new PersonIdent(committerIdent, commitDate, timeZone)); ObjectInserter inserter = repo.newObjectInserter(); + ObjectId commitId; try { - inserter.insert(commit); + commitId = inserter.insert(commit); inserter.flush(); } finally { inserter.release(); } final RefUpdate ru = repo.updateRef(Constants.HEAD); - ru.setNewObjectId(commit.getCommitId()); + ru.setNewObjectId(commitId); ru.setRefLogMessage(buildReflogMessage(commitMessage), false); if (ru.forceUpdate() == RefUpdate.Result.LOCK_FAILURE) { throw new TeamException(NLS.bind( CoreText.CommitOperation_failedToUpdate, ru.getName(), - commit.getCommitId())); + commitId)); } } } diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TagOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TagOperation.java index cce932c970..d20ef3c9c9 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TagOperation.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TagOperation.java @@ -58,10 +58,10 @@ public class TagOperation implements IEGitOperation { monitor.beginTask(NLS.bind(CoreText.TagOperation_performingTagging, tag.getTag()), 3); - updateTagObject(); + ObjectId tagId = updateTagObject(); monitor.worked(1); - updateRepo(); + updateRepo(tagId); monitor.worked(1); } finally { @@ -69,12 +69,12 @@ public class TagOperation implements IEGitOperation { } } - private void updateRepo() throws TeamException { + private void updateRepo(ObjectId tagId) throws TeamException { String refName = Constants.R_TAGS + tag.getTag(); try { RefUpdate tagRef = repo.updateRef(refName); - tagRef.setNewObjectId(tag.getTagId()); + tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); @@ -88,18 +88,20 @@ public class TagOperation implements IEGitOperation { } } - private void updateTagObject() throws TeamException { + private ObjectId updateTagObject() throws TeamException { ObjectId startPointRef = tag.getObjectId(); try { + ObjectId tagId; repo.open(startPointRef); ObjectInserter inserter = repo.newObjectInserter(); try { - inserter.insert(tag); + tagId = inserter.insert(tag); inserter.flush(); } finally { inserter.release(); } + return tagId; } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_objectIdNotFound, tag.getTag(), e.getMessage()), e); |