Example #1
0
        private static void Different(string commit)
        {
            commit = OidConverter(commit);
            var tree   = CommitOperation.GetCommit(commit).Tree;
            var result = Diff.DiffTrees(TreeOperation.GetTree(tree), TreeOperation.GetWorkingTree());

            Console.WriteLine(result);
        }
Example #2
0
        public void GetTreeTest()
        {
            dataProvider.Setup(d => d.GetObject("foo-oid", "tree")).Returns(string.Join("\n", new []
            {
                "blob a-oid a.txt",
                "tree bar-oid bar"
            }).Encode());

            dataProvider.Setup(d => d.GetObject("bar-oid", "tree")).Returns(string.Join("\n", new[]
            {
                "blob b-oid b.txt",
                "blob c-oid c.md"
            }).Encode());

            var tree = treeOpeartion.GetTree("foo-oid", "");

            Assert.AreEqual(3, tree.Count);
            Assert.IsTrue(tree.ContainsKey(Path.Join("a.txt")));
            Assert.IsTrue(tree.ContainsKey(Path.Join("bar", "b.txt")));
            Assert.IsTrue(tree.ContainsKey(Path.Join("bar", "c.md")));
        }