Ejemplo n.º 1
0
        public virtual void TestUpdateWorkingDirectory()
        {
            CheckoutCommand co      = git.Checkout();
            FilePath        written = WriteTrashFile(FILE1, string.Empty);

            NUnit.Framework.Assert.AreEqual(string.Empty, Read(written));
            co.AddPath(FILE1).Call();
            NUnit.Framework.Assert.AreEqual("3", Read(written));
            NUnit.Framework.Assert.AreEqual("c", Read(new FilePath(db.WorkTree, FILE2)));
        }
Ejemplo n.º 2
0
        public virtual void TestUpdateWorkingDirectoryFromHeadWithIndexChange()
        {
            CheckoutCommand co      = git.Checkout();
            FilePath        written = WriteTrashFile(FILE1, "3a");

            git.Add().AddFilepattern(FILE1).Call();
            written = WriteTrashFile(FILE1, string.Empty);
            NUnit.Framework.Assert.AreEqual(string.Empty, Read(written));
            co.AddPath(FILE1).SetStartPoint("HEAD").Call();
            NUnit.Framework.Assert.AreEqual("3", Read(written));
            NUnit.Framework.Assert.AreEqual("c", Read(new FilePath(db.WorkTree, FILE2)));
        }
Ejemplo n.º 3
0
        public virtual void TestUpdateWorkingDirectoryFromIndex2()
        {
            CheckoutCommand co = git.Checkout();

            FsTick(git.GetRepository().GetIndexFile());
            FilePath written1 = WriteTrashFile(FILE1, "3(modified)");
            FilePath written2 = WriteTrashFile(FILE2, "a(modified)");

            FsTick(written2);
            // make sure that we get unsmudged entries for FILE1 and FILE2
            WriteTrashFile(FILE3, "foo");
            git.Add().AddFilepattern(FILE3).Call();
            FsTick(git.GetRepository().GetIndexFile());
            git.Add().AddFilepattern(FILE1).AddFilepattern(FILE2).Call();
            FsTick(git.GetRepository().GetIndexFile());
            WriteTrashFile(FILE1, "3(modified again)");
            WriteTrashFile(FILE2, "a(modified again)");
            FsTick(written2);
            co.AddPath(FILE1).SetStartPoint(secondCommit).Call();
            NUnit.Framework.Assert.AreEqual("2", Read(written1));
            NUnit.Framework.Assert.AreEqual("a(modified again)", Read(written2));
            ValidateIndex(git);
        }