Пример #1
0
 public virtual void TestFindingConflicts()
 {
     GitIndex index = new GitIndex(db);
     index.Add(trash, WriteTrashFile("bar", "bar"));
     index.Add(trash, WriteTrashFile("foo/bar/baz/qux", "foo/bar"));
     RecursiveDelete(new FilePath(trash, "bar"));
     RecursiveDelete(new FilePath(trash, "foo"));
     WriteTrashFile("bar/baz/qux/foo", "another nasty one");
     WriteTrashFile("foo", "troublesome little bugger");
     WorkDirCheckout workDirCheckout = new WorkDirCheckout(db, trash, index, index);
     workDirCheckout.PrescanOneTree();
     IList<string> conflictingEntries = workDirCheckout.GetConflicts();
     IList<string> removedEntries = workDirCheckout.GetRemoved();
     NUnit.Framework.Assert.AreEqual("bar/baz/qux/foo", conflictingEntries[0]);
     NUnit.Framework.Assert.AreEqual("foo", conflictingEntries[1]);
     GitIndex index2 = new GitIndex(db);
     RecursiveDelete(new FilePath(trash, "bar"));
     RecursiveDelete(new FilePath(trash, "foo"));
     index2.Add(trash, WriteTrashFile("bar/baz/qux/foo", "bar"));
     index2.Add(trash, WriteTrashFile("foo", "lalala"));
     workDirCheckout = new WorkDirCheckout(db, trash, index2, index);
     workDirCheckout.PrescanOneTree();
     conflictingEntries = workDirCheckout.GetConflicts();
     removedEntries = workDirCheckout.GetRemoved();
     NUnit.Framework.Assert.IsTrue(conflictingEntries.IsEmpty());
     NUnit.Framework.Assert.IsTrue(removedEntries.Contains("bar/baz/qux/foo"));
     NUnit.Framework.Assert.IsTrue(removedEntries.Contains("foo"));
 }