|
|
@ -83,7 +83,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
// open when we create it we won't write the object file out as a loose
|
|
|
|
// open when we create it we won't write the object file out as a loose
|
|
|
|
// object (as it already exists in the pack).
|
|
|
|
// object (as it already exists in the pack).
|
|
|
|
//
|
|
|
|
//
|
|
|
|
final Repository newdb = createNewEmptyRepo(); |
|
|
|
final Repository newdb = createBareRepository(); |
|
|
|
final Tree t = new Tree(newdb); |
|
|
|
final Tree t = new Tree(newdb); |
|
|
|
t.accept(new WriteTree(trash, newdb), TreeEntry.MODIFIED_ONLY); |
|
|
|
t.accept(new WriteTree(trash, newdb), TreeEntry.MODIFIED_ONLY); |
|
|
|
assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() |
|
|
|
assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() |
|
|
@ -101,7 +101,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.accept(new WriteTree(trash, db), TreeEntry.MODIFIED_ONLY); |
|
|
|
t.accept(new WriteTree(trash, db), TreeEntry.MODIFIED_ONLY); |
|
|
|
assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() |
|
|
|
assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", t.getId() |
|
|
|
.name()); |
|
|
|
.name()); |
|
|
|
final File o = new File(new File(new File(trash_git, "objects"), "4b"), |
|
|
|
final File o = new File(new File( |
|
|
|
|
|
|
|
new File(db.getDirectory(), "objects"), "4b"), |
|
|
|
"825dc642cb6eb9a060e54bf8d69288fbee4904"); |
|
|
|
"825dc642cb6eb9a060e54bf8d69288fbee4904"); |
|
|
|
assertFalse("Exists " + o, o.isFile()); |
|
|
|
assertFalse("Exists " + o, o.isFile()); |
|
|
|
} |
|
|
|
} |
|
|
@ -115,12 +116,12 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
.name()); |
|
|
|
.name()); |
|
|
|
|
|
|
|
|
|
|
|
File o; |
|
|
|
File o; |
|
|
|
o = new File(new File(new File(trash_git, "objects"), "7b"), |
|
|
|
o = new File(new File(new File(db.getDirectory(), "objects"), "7b"), |
|
|
|
"b943559a305bdd6bdee2cef6e5df2413c3d30a"); |
|
|
|
"b943559a305bdd6bdee2cef6e5df2413c3d30a"); |
|
|
|
assertTrue("Exists " + o, o.isFile()); |
|
|
|
assertTrue("Exists " + o, o.isFile()); |
|
|
|
assertTrue("Read-only " + o, !o.canWrite()); |
|
|
|
assertTrue("Read-only " + o, !o.canWrite()); |
|
|
|
|
|
|
|
|
|
|
|
o = new File(new File(new File(trash_git, "objects"), "e6"), |
|
|
|
o = new File(new File(new File(db.getDirectory(), "objects"), "e6"), |
|
|
|
"9de29bb2d1d6434b8b29ae775ad8c2e48c5391"); |
|
|
|
"9de29bb2d1d6434b8b29ae775ad8c2e48c5391"); |
|
|
|
assertTrue("Exists " + o, o.isFile()); |
|
|
|
assertTrue("Exists " + o, o.isFile()); |
|
|
|
assertTrue("Read-only " + o, !o.canWrite()); |
|
|
|
assertTrue("Read-only " + o, !o.canWrite()); |
|
|
@ -202,8 +203,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.getTreeId()); |
|
|
|
t.getTreeId()); |
|
|
|
|
|
|
|
|
|
|
|
final Commit c = new Commit(db); |
|
|
|
final Commit c = new Commit(db); |
|
|
|
c.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
c.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
c.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); |
|
|
|
c.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); |
|
|
|
c.setMessage("A Commit\n"); |
|
|
|
c.setMessage("A Commit\n"); |
|
|
|
c.setTree(t); |
|
|
|
c.setTree(t); |
|
|
|
assertEquals(t.getTreeId(), c.getTreeId()); |
|
|
|
assertEquals(t.getTreeId(), c.getTreeId()); |
|
|
@ -258,7 +259,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.setObjId(emptyId); |
|
|
|
t.setObjId(emptyId); |
|
|
|
t.setType("blob"); |
|
|
|
t.setType("blob"); |
|
|
|
t.setTag("test020"); |
|
|
|
t.setTag("test020"); |
|
|
|
t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
t.setMessage("test020 tagged\n"); |
|
|
|
t.setMessage("test020 tagged\n"); |
|
|
|
t.tag(); |
|
|
|
t.tag(); |
|
|
|
assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().name()); |
|
|
|
assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().name()); |
|
|
@ -266,7 +267,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
Tag mapTag = db.mapTag("test020"); |
|
|
|
Tag mapTag = db.mapTag("test020"); |
|
|
|
assertEquals("blob", mapTag.getType()); |
|
|
|
assertEquals("blob", mapTag.getType()); |
|
|
|
assertEquals("test020 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals("test020 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().name()); |
|
|
|
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -292,7 +293,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.setObjId(almostEmptyTreeId); |
|
|
|
t.setObjId(almostEmptyTreeId); |
|
|
|
t.setType("tree"); |
|
|
|
t.setType("tree"); |
|
|
|
t.setTag("test021"); |
|
|
|
t.setTag("test021"); |
|
|
|
t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
t.setMessage("test021 tagged\n"); |
|
|
|
t.setMessage("test021 tagged\n"); |
|
|
|
t.tag(); |
|
|
|
t.tag(); |
|
|
|
assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().name()); |
|
|
|
assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().name()); |
|
|
@ -300,7 +301,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
Tag mapTag = db.mapTag("test021"); |
|
|
|
Tag mapTag = db.mapTag("test021"); |
|
|
|
assertEquals("tree", mapTag.getType()); |
|
|
|
assertEquals("tree", mapTag.getType()); |
|
|
|
assertEquals("test021 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals("test021 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag.getObjId().name()); |
|
|
|
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag.getObjId().name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -310,8 +311,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); |
|
|
|
almostEmptyTree.addEntry(new FileTreeEntry(almostEmptyTree, emptyId, "empty".getBytes(), false)); |
|
|
|
final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); |
|
|
|
final ObjectId almostEmptyTreeId = new ObjectWriter(db).writeTree(almostEmptyTree); |
|
|
|
final Commit almostEmptyCommit = new Commit(db); |
|
|
|
final Commit almostEmptyCommit = new Commit(db); |
|
|
|
almostEmptyCommit.setAuthor(new PersonIdent(jauthor, 1154236443000L, -2 * 60)); // not exactly the same
|
|
|
|
almostEmptyCommit.setAuthor(new PersonIdent(author, 1154236443000L, -2 * 60)); // not exactly the same
|
|
|
|
almostEmptyCommit.setCommitter(new PersonIdent(jauthor, 1154236443000L, -2 * 60)); |
|
|
|
almostEmptyCommit.setCommitter(new PersonIdent(author, 1154236443000L, -2 * 60)); |
|
|
|
almostEmptyCommit.setMessage("test022\n"); |
|
|
|
almostEmptyCommit.setMessage("test022\n"); |
|
|
|
almostEmptyCommit.setTreeId(almostEmptyTreeId); |
|
|
|
almostEmptyCommit.setTreeId(almostEmptyTreeId); |
|
|
|
ObjectId almostEmptyCommitId = new ObjectWriter(db).writeCommit(almostEmptyCommit); |
|
|
|
ObjectId almostEmptyCommitId = new ObjectWriter(db).writeCommit(almostEmptyCommit); |
|
|
@ -319,7 +320,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.setObjId(almostEmptyCommitId); |
|
|
|
t.setObjId(almostEmptyCommitId); |
|
|
|
t.setType("commit"); |
|
|
|
t.setType("commit"); |
|
|
|
t.setTag("test022"); |
|
|
|
t.setTag("test022"); |
|
|
|
t.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
t.setMessage("test022 tagged\n"); |
|
|
|
t.setMessage("test022 tagged\n"); |
|
|
|
t.tag(); |
|
|
|
t.tag(); |
|
|
|
assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().name()); |
|
|
|
assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().name()); |
|
|
@ -327,7 +328,7 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
Tag mapTag = db.mapTag("test022"); |
|
|
|
Tag mapTag = db.mapTag("test022"); |
|
|
|
assertEquals("commit", mapTag.getType()); |
|
|
|
assertEquals("commit", mapTag.getType()); |
|
|
|
assertEquals("test022 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals("test022 tagged\n", mapTag.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); |
|
|
|
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.getObjId().name()); |
|
|
|
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.getObjId().name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -392,19 +393,19 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
assertNotNull("have tag test020", mapTag20); |
|
|
|
assertNotNull("have tag test020", mapTag20); |
|
|
|
assertEquals("blob", mapTag20.getType()); |
|
|
|
assertEquals("blob", mapTag20.getType()); |
|
|
|
assertEquals("test020 tagged\n", mapTag20.getMessage()); |
|
|
|
assertEquals("test020 tagged\n", mapTag20.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag20.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag20.getAuthor()); |
|
|
|
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().name()); |
|
|
|
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().name()); |
|
|
|
|
|
|
|
|
|
|
|
Tag mapTag21 = db.mapTag("test021"); |
|
|
|
Tag mapTag21 = db.mapTag("test021"); |
|
|
|
assertEquals("tree", mapTag21.getType()); |
|
|
|
assertEquals("tree", mapTag21.getType()); |
|
|
|
assertEquals("test021 tagged\n", mapTag21.getMessage()); |
|
|
|
assertEquals("test021 tagged\n", mapTag21.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag21.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag21.getAuthor()); |
|
|
|
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().name()); |
|
|
|
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().name()); |
|
|
|
|
|
|
|
|
|
|
|
Tag mapTag22 = db.mapTag("test022"); |
|
|
|
Tag mapTag22 = db.mapTag("test022"); |
|
|
|
assertEquals("commit", mapTag22.getType()); |
|
|
|
assertEquals("commit", mapTag22.getType()); |
|
|
|
assertEquals("test022 tagged\n", mapTag22.getMessage()); |
|
|
|
assertEquals("test022 tagged\n", mapTag22.getMessage()); |
|
|
|
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag22.getAuthor()); |
|
|
|
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag22.getAuthor()); |
|
|
|
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().name()); |
|
|
|
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -426,8 +427,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
t.getTreeId()); |
|
|
|
t.getTreeId()); |
|
|
|
|
|
|
|
|
|
|
|
final Commit c1 = new Commit(db); |
|
|
|
final Commit c1 = new Commit(db); |
|
|
|
c1.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
c1.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
c1.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); |
|
|
|
c1.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); |
|
|
|
c1.setMessage("A Commit\n"); |
|
|
|
c1.setMessage("A Commit\n"); |
|
|
|
c1.setTree(t); |
|
|
|
c1.setTree(t); |
|
|
|
assertEquals(t.getTreeId(), c1.getTreeId()); |
|
|
|
assertEquals(t.getTreeId(), c1.getTreeId()); |
|
|
@ -437,8 +438,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
assertEquals(cmtid1, c1.getCommitId()); |
|
|
|
assertEquals(cmtid1, c1.getCommitId()); |
|
|
|
|
|
|
|
|
|
|
|
final Commit c2 = new Commit(db); |
|
|
|
final Commit c2 = new Commit(db); |
|
|
|
c2.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
c2.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
c2.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); |
|
|
|
c2.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); |
|
|
|
c2.setMessage("A Commit 2\n"); |
|
|
|
c2.setMessage("A Commit 2\n"); |
|
|
|
c2.setTree(t); |
|
|
|
c2.setTree(t); |
|
|
|
assertEquals(t.getTreeId(), c2.getTreeId()); |
|
|
|
assertEquals(t.getTreeId(), c2.getTreeId()); |
|
|
@ -458,8 +459,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
assertEquals(c1.getCommitId(), rm2.getParentIds()[0]); |
|
|
|
assertEquals(c1.getCommitId(), rm2.getParentIds()[0]); |
|
|
|
|
|
|
|
|
|
|
|
final Commit c3 = new Commit(db); |
|
|
|
final Commit c3 = new Commit(db); |
|
|
|
c3.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
c3.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
c3.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); |
|
|
|
c3.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); |
|
|
|
c3.setMessage("A Commit 3\n"); |
|
|
|
c3.setMessage("A Commit 3\n"); |
|
|
|
c3.setTree(t); |
|
|
|
c3.setTree(t); |
|
|
|
assertEquals(t.getTreeId(), c3.getTreeId()); |
|
|
|
assertEquals(t.getTreeId(), c3.getTreeId()); |
|
|
@ -480,8 +481,8 @@ public class T0003_Basic extends RepositoryTestCase { |
|
|
|
assertEquals(c2.getCommitId(), rm3.getParentIds()[1]); |
|
|
|
assertEquals(c2.getCommitId(), rm3.getParentIds()[1]); |
|
|
|
|
|
|
|
|
|
|
|
final Commit c4 = new Commit(db); |
|
|
|
final Commit c4 = new Commit(db); |
|
|
|
c4.setAuthor(new PersonIdent(jauthor, 1154236443000L, -4 * 60)); |
|
|
|
c4.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); |
|
|
|
c4.setCommitter(new PersonIdent(jcommitter, 1154236443000L, -4 * 60)); |
|
|
|
c4.setCommitter(new PersonIdent(committer, 1154236443000L, -4 * 60)); |
|
|
|
c4.setMessage("A Commit 4\n"); |
|
|
|
c4.setMessage("A Commit 4\n"); |
|
|
|
c4.setTree(t); |
|
|
|
c4.setTree(t); |
|
|
|
assertEquals(t.getTreeId(), c3.getTreeId()); |
|
|
|
assertEquals(t.getTreeId(), c3.getTreeId()); |
|
|
|