public virtual void TestGetRefs_PackedWithPeeled() { IDictionary <string, Ref> all; WritePackedRefs("# pack-refs with: peeled \n" + A.Name + " refs/heads/master\n" + B.Name + " refs/heads/other\n" + v1_0.Name + " refs/tags/v1.0\n" + "^" + v1_0.GetObject ().Name + "\n"); // // // // all = refdir.GetRefs(RefDatabase.ALL); NUnit.Framework.Assert.AreEqual(4, all.Count); Ref head = all.Get(Constants.HEAD); Ref master = all.Get("refs/heads/master"); Ref other = all.Get("refs/heads/other"); Ref tag = all.Get("refs/tags/v1.0"); NUnit.Framework.Assert.AreEqual(A, master.GetObjectId()); NUnit.Framework.Assert.IsTrue(master.IsPeeled()); NUnit.Framework.Assert.IsNull(master.GetPeeledObjectId()); NUnit.Framework.Assert.AreEqual(B, other.GetObjectId()); NUnit.Framework.Assert.IsTrue(other.IsPeeled()); NUnit.Framework.Assert.IsNull(other.GetPeeledObjectId()); NUnit.Framework.Assert.AreSame(master, head.GetTarget()); NUnit.Framework.Assert.AreEqual(A, head.GetObjectId()); NUnit.Framework.Assert.IsTrue(head.IsPeeled()); NUnit.Framework.Assert.IsNull(head.GetPeeledObjectId()); NUnit.Framework.Assert.AreEqual(v1_0, tag.GetObjectId()); NUnit.Framework.Assert.IsTrue(tag.IsPeeled()); NUnit.Framework.Assert.AreEqual(v1_0.GetObject(), tag.GetPeeledObjectId()); }
private void ProcessTag(RevObject obj) { RevTag tag = (RevTag)obj; Needs(tag.GetObject()); obj.Add(COMPLETE); }
public virtual void Test022_createCommitTag() { ObjectId emptyId = InsertEmptyBlob(); Tree almostEmptyTree = new Tree(db); almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString ("empty"), false)); ObjectId almostEmptyTreeId = InsertTree(almostEmptyTree); NGit.CommitBuilder almostEmptyCommit = new NGit.CommitBuilder(); almostEmptyCommit.Author = new PersonIdent(author, 1154236443000L, -2 * 60); // not exactly the same almostEmptyCommit.Committer = new PersonIdent(author, 1154236443000L, -2 * 60); almostEmptyCommit.Message = "test022\n"; almostEmptyCommit.TreeId = almostEmptyTreeId; ObjectId almostEmptyCommitId = InsertCommit(almostEmptyCommit); TagBuilder t = new TagBuilder(); t.SetObjectId(almostEmptyCommitId, Constants.OBJ_COMMIT); t.SetTag("test022"); t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); t.SetMessage("test022 tagged\n"); ObjectId actid = InsertTag(t); NUnit.Framework.Assert.AreEqual("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", actid .Name); RevTag mapTag = ParseTag(actid); NUnit.Framework.Assert.AreEqual(Constants.OBJ_COMMIT, mapTag.GetObject().Type); NUnit.Framework.Assert.AreEqual("test022 tagged\n", mapTag.GetFullMessage()); NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.GetTaggerIdent()); NUnit.Framework.Assert.AreEqual("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag .GetObject().Id.Name); }
public virtual void Test021_createTreeTag() { ObjectId emptyId = InsertEmptyBlob(); Tree almostEmptyTree = new Tree(db); almostEmptyTree.AddEntry(new FileTreeEntry(almostEmptyTree, emptyId, Sharpen.Runtime.GetBytesForString ("empty"), false)); ObjectId almostEmptyTreeId = InsertTree(almostEmptyTree); TagBuilder t = new TagBuilder(); t.SetObjectId(almostEmptyTreeId, Constants.OBJ_TREE); t.SetTag("test021"); t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); t.SetMessage("test021 tagged\n"); ObjectId actid = InsertTag(t); NUnit.Framework.Assert.AreEqual("b0517bc8dbe2096b419d42424cd7030733f4abe5", actid .Name); RevTag mapTag = ParseTag(actid); NUnit.Framework.Assert.AreEqual(Constants.OBJ_TREE, mapTag.GetObject().Type); NUnit.Framework.Assert.AreEqual("test021 tagged\n", mapTag.GetFullMessage()); NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.GetTaggerIdent()); NUnit.Framework.Assert.AreEqual("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag .GetObject().Id.Name); }
public virtual void TestTaggingOnHead() { Git git = new Git(db); RevCommit commit = git.Commit().SetMessage("initial commit").Call(); RevTag tag = git.Tag().SetName("tag").Call(); NUnit.Framework.Assert.AreEqual(commit.Id, tag.GetObject().Id); }
public virtual void Test020_createBlobTag() { ObjectId emptyId = InsertEmptyBlob(); TagBuilder t = new TagBuilder(); t.SetObjectId(emptyId, Constants.OBJ_BLOB); t.SetTag("test020"); t.SetTagger(new PersonIdent(author, 1154236443000L, -4 * 60)); t.SetMessage("test020 tagged\n"); ObjectId actid = InsertTag(t); NUnit.Framework.Assert.AreEqual("6759556b09fbb4fd8ae5e315134481cc25d46954", actid .Name); RevTag mapTag = ParseTag(actid); NUnit.Framework.Assert.AreEqual(Constants.OBJ_BLOB, mapTag.GetObject().Type); NUnit.Framework.Assert.AreEqual("test020 tagged\n", mapTag.GetFullMessage()); NUnit.Framework.Assert.AreEqual(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.GetTaggerIdent()); NUnit.Framework.Assert.AreEqual("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag .GetObject().Id.Name); }