Пример #1
0
        public void testNoCacheObjectIdSubclass()
        {
            string newRef = "refs/heads/abc";
            RefUpdate ru = updateRef(newRef);
            RevCommit newid = new RevCommit(ru.NewObjectId)
            {
                // empty
            };

            ru.NewObjectId = newid;
            RefUpdate.RefUpdateResult update = ru.Update();
            Assert.AreEqual(RefUpdate.RefUpdateResult.New, update);
            Ref r = db.getAllRefs()[newRef];
            Assert.IsNotNull(r);
            Assert.AreEqual(newRef, r.Name);
            Assert.IsNotNull(r.ObjectId);
            Assert.AreNotSame(newid, r.ObjectId);
            Assert.AreSame(typeof (ObjectId), r.ObjectId.GetType());
            Assert.AreEqual(newid.Copy(), r.ObjectId);
            IList<ReflogReader.Entry> reverseEntries1 = db.ReflogReader("refs/heads/abc").getReverseEntries();
            ReflogReader.Entry entry1 = reverseEntries1[0];
            Assert.AreEqual(1, reverseEntries1.Count);
            Assert.AreEqual(ObjectId.ZeroId, entry1.getOldId());
            Assert.AreEqual(r.ObjectId, entry1.getNewId());
            Assert.AreEqual(new PersonIdent(db).ToString(), entry1.getWho().ToString());
            Assert.AreEqual("", entry1.getComment());
            IList<ReflogReader.Entry> reverseEntries2 = db.ReflogReader("HEAD").getReverseEntries();
            Assert.AreEqual(0, reverseEntries2.Count);
        }