aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-08-23 10:13:25 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-08-23 10:13:29 -0700
commit6df5d3397c5c9354409d21a8e207a061f2e6efc2 (patch)
treeac334cbeffe7a1616a0b24452e5c64004843106a /org.eclipse.jgit.test/tst/org/eclipse/jgit/storage
parent22b285695a2980824c15363ef5fec709ebc3d434 (diff)
downloadjgit-6df5d3397c5c9354409d21a8e207a061f2e6efc2.tar.gz
jgit-6df5d3397c5c9354409d21a8e207a061f2e6efc2.zip
Move commit and tag formatting to CommitBuilder, TagBuilder
These objects should be responsible for their own formatting, rather than delegating it to some obtuse type called ObjectInserter. While we are at it, simplify the way we insert these into a database. Passing in the type and calling format in application code turned out to be a huge mistake in terms of ease-of-use of the insert API. Change-Id: Id5bb95ee56aa2a002243e9b7853b84ec8df1d7bf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/storage')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
index cd802d41ec..0352a40bfd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
@@ -693,13 +693,12 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
}
- private ObjectId insertCommit(final CommitBuilder commit) throws IOException,
+ private ObjectId insertCommit(final CommitBuilder builder) throws IOException,
UnsupportedEncodingException {
ObjectInserter oi = db.newObjectInserter();
try {
- ObjectId id = oi.insert(Constants.OBJ_COMMIT, oi.format(commit));
+ ObjectId id = oi.insert(builder);
oi.flush();
- commit.setCommitId(id);
return id;
} finally {
oi.release();
@@ -721,9 +720,8 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
UnsupportedEncodingException {
ObjectInserter oi = db.newObjectInserter();
try {
- ObjectId id = oi.insert(Constants.OBJ_TAG, oi.format(tag));
+ ObjectId id = oi.insert(tag);
oi.flush();
- tag.setTagId(id);
return id;
} finally {
oi.release();