public virtual void TestTrivialTwoWay_validSubtreeSort() { DirCache treeB = db.ReadDirCache(); DirCache treeO = db.ReadDirCache(); DirCache treeT = db.ReadDirCache(); { DirCacheBuilder b = treeB.Builder(); DirCacheBuilder o = treeO.Builder(); DirCacheBuilder t = treeT.Builder(); b.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); b.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE)); o.Add(CreateEntry("Makefile", FileMode.REGULAR_FILE)); o.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); o.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE)); t.Add(CreateEntry("libelf-po/a", FileMode.REGULAR_FILE)); t.Add(CreateEntry("libelf/c", FileMode.REGULAR_FILE, "blah")); b.Finish(); o.Finish(); t.Finish(); } ObjectInserter ow = db.NewObjectInserter(); ObjectId b_1 = Commit(ow, treeB, new ObjectId[] { }); ObjectId o_1 = Commit(ow, treeO, new ObjectId[] { b_1 }); ObjectId t_1 = Commit(ow, treeT, new ObjectId[] { b_1 }); Merger ourMerger = ((ThreeWayMerger)MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.NewMerger (db)); bool merge = ourMerger.Merge(new ObjectId[] { o_1, t_1 }); NUnit.Framework.Assert.IsTrue(merge); TreeWalk tw = new TreeWalk(db); tw.Recursive = true; tw.Reset(ourMerger.GetResultTreeId()); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("Makefile", tw.PathString); AssertCorrectId(treeO, tw); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("libelf-po/a", tw.PathString); AssertCorrectId(treeO, tw); NUnit.Framework.Assert.IsTrue(tw.Next()); NUnit.Framework.Assert.AreEqual("libelf/c", tw.PathString); AssertCorrectId(treeT, tw); NUnit.Framework.Assert.IsFalse(tw.Next()); }