/// <exception cref="NGit.Errors.CorruptObjectException"></exception> internal override void PopEntriesEqual() { AbstractTreeIterator ch = currentHead; for (int i = 0; i < trees.Length; i++) { AbstractTreeIterator t = trees[i]; if (t.matches == ch) { if (t.matchShift == 0) { t.Next(1); } else { t.Back(t.matchShift); t.matchShift = 0; } t.matches = null; } } if (ch == dfConflict) { dfConflict = null; } }
/// <exception cref="NGit.Errors.CorruptObjectException"></exception> internal virtual void PopEntriesEqual() { AbstractTreeIterator ch = currentHead; for (int i = 0; i < trees.Length; i++) { AbstractTreeIterator t = trees[i]; if (t.matches == ch) { t.Next(1); t.matches = null; } } }
public virtual void TestSimpleIterate() { FileTreeIterator top = new FileTreeIterator(trash, db.FileSystem, ((FileBasedConfig )db.GetConfig()).Get(WorkingTreeOptions.KEY)); NUnit.Framework.Assert.IsTrue(top.First); NUnit.Framework.Assert.IsFalse(top.Eof); NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode); NUnit.Framework.Assert.AreEqual(paths[0], NameOf(top)); NUnit.Framework.Assert.AreEqual(paths[0].Length, top.GetEntryLength()); NUnit.Framework.Assert.AreEqual(mtime[0], top.GetEntryLastModified()); top.Next(1); NUnit.Framework.Assert.IsFalse(top.First); NUnit.Framework.Assert.IsFalse(top.Eof); NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode); NUnit.Framework.Assert.AreEqual(paths[1], NameOf(top)); NUnit.Framework.Assert.AreEqual(paths[1].Length, top.GetEntryLength()); NUnit.Framework.Assert.AreEqual(mtime[1], top.GetEntryLastModified()); top.Next(1); NUnit.Framework.Assert.IsFalse(top.First); NUnit.Framework.Assert.IsFalse(top.Eof); NUnit.Framework.Assert.AreEqual(FileMode.TREE.GetBits(), top.mode); ObjectReader reader = db.NewObjectReader(); AbstractTreeIterator sub = top.CreateSubtreeIterator(reader); NUnit.Framework.Assert.IsTrue(sub is FileTreeIterator); FileTreeIterator subfti = (FileTreeIterator)sub; NUnit.Framework.Assert.IsTrue(sub.First); NUnit.Framework.Assert.IsFalse(sub.Eof); NUnit.Framework.Assert.AreEqual(paths[2], NameOf(sub)); NUnit.Framework.Assert.AreEqual(paths[2].Length, subfti.GetEntryLength()); NUnit.Framework.Assert.AreEqual(mtime[2], subfti.GetEntryLastModified()); sub.Next(1); NUnit.Framework.Assert.IsTrue(sub.Eof); top.Next(1); NUnit.Framework.Assert.IsFalse(top.First); NUnit.Framework.Assert.IsFalse(top.Eof); NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode); NUnit.Framework.Assert.AreEqual(paths[3], NameOf(top)); NUnit.Framework.Assert.AreEqual(paths[3].Length, top.GetEntryLength()); NUnit.Framework.Assert.AreEqual(mtime[3], top.GetEntryLastModified()); top.Next(1); NUnit.Framework.Assert.IsTrue(top.Eof); }