Exemplo n.º 1
0
        public void testDirectoryFileSimple()
        {
            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF", "DF"));
            Core.Tree head = db.MapTree(_theIndex.writeTree());
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
            Core.Tree merge = db.MapTree(_theIndex.writeTree());
            _theIndex = new GitIndex(db);
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex.add(trash, writeTrashFile("DF", "DF"));
            _theReadTree = new WorkDirCheckout(db, trash, head, _theIndex, merge);
            _theReadTree.PrescanTwoTrees();
            Assert.IsTrue(_theReadTree.Removed.Contains("DF"));
            Assert.IsTrue(_theReadTree.Updated.ContainsKey("DF/DF"));
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
            _theReadTree = new WorkDirCheckout(db, trash, merge, _theIndex, head);
            _theReadTree.PrescanTwoTrees();
            Assert.IsTrue(_theReadTree.Removed.Contains("DF/DF"));
            Assert.IsTrue(_theReadTree.Updated.ContainsKey("DF"));
        }
Exemplo n.º 2
0
        public void testRules1thru3_NoIndexEntry()
        {
            var           index    = new GitIndex(db);
            var           head     = new Core.Tree(db);
            FileTreeEntry entry    = head.AddFile("foo");
            ObjectId      expected = ObjectId.FromString("ba78e065e2c261d4f7b8f42107588051e87e18e9");

            entry.Id = expected;
            var merge    = new Core.Tree(db);
            var checkout = new WorkDirCheckout(db, trash, head, index, merge);

            checkout.PrescanTwoTrees();
            Assert.IsTrue(checkout.Removed.Contains("foo"));
            checkout = new WorkDirCheckout(db, trash, merge, index, head);
            checkout.PrescanTwoTrees();
            Assert.AreEqual(expected, checkout.Updated["foo"]);
            ObjectId id2 = ObjectId.FromString("ba78e065e2c261d4f7b8f42107588051e87e18ee");

            merge.AddFile("foo").Id = id2;
            checkout = new WorkDirCheckout(db, trash, head, index, merge);
            checkout.PrescanTwoTrees();
            Assert.AreEqual(id2, checkout.Updated["foo"]);
        }
Exemplo n.º 3
0
 private WorkDirCheckout Go()
 {
     _theReadTree = new WorkDirCheckout(db, trash, _theHead, _theIndex, _theMerge);
     _theReadTree.PrescanTwoTrees();
     return(_theReadTree);
 }
Exemplo n.º 4
0
 private WorkDirCheckout Go()
 {
     _theReadTree = new WorkDirCheckout(db, trash, _theHead, _theIndex, _theMerge);
     _theReadTree.PrescanTwoTrees();
     return _theReadTree;
 }
Exemplo n.º 5
0
 public void testRules1thru3_NoIndexEntry()
 {
     var index = new GitIndex(db);
     var head = new Tree(db);
     FileTreeEntry entry = head.AddFile("foo");
     ObjectId expected = ObjectId.FromString("ba78e065e2c261d4f7b8f42107588051e87e18e9");
     entry.Id = expected;
     var merge = new Tree(db);
     var checkout = new WorkDirCheckout(db, trash, head, index, merge);
     checkout.PrescanTwoTrees();
     Assert.IsTrue(checkout.Removed.Contains("foo"));
     checkout = new WorkDirCheckout(db, trash, merge, index, head);
     checkout.PrescanTwoTrees();
     Assert.AreEqual(expected, checkout.Updated["foo"]);
     ObjectId id2 = ObjectId.FromString("ba78e065e2c261d4f7b8f42107588051e87e18ee");
     merge.AddFile("foo").Id = id2;
     checkout = new WorkDirCheckout(db, trash, head, index, merge);
     checkout.PrescanTwoTrees();
     Assert.AreEqual(id2, checkout.Updated["foo"]);
 }
Exemplo n.º 6
0
        public void testDirectoryFileSimple()
        {
            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF", "DF"));
            Tree head = db.MapTree(_theIndex.writeTree());
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
            Tree merge = db.MapTree(_theIndex.writeTree());
            _theIndex = new GitIndex(db);
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex.add(trash, writeTrashFile("DF", "DF"));
            _theReadTree = new WorkDirCheckout(db, trash, head, _theIndex, merge);
            _theReadTree.PrescanTwoTrees();
            Assert.IsTrue(_theReadTree.Removed.Contains("DF"));
            Assert.IsTrue(_theReadTree.Updated.ContainsKey("DF/DF"));
            recursiveDelete(new DirectoryInfo(Path.Combine(trash.FullName, "DF")));

            _theIndex = new GitIndex(db);
            _theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF"));
            _theReadTree = new WorkDirCheckout(db, trash, merge, _theIndex, head);
            _theReadTree.PrescanTwoTrees();
            Assert.IsTrue(_theReadTree.Removed.Contains("DF/DF"));
            Assert.IsTrue(_theReadTree.Updated.ContainsKey("DF"));
        }