public void testBuildThenClear() { DirCache dc = DirCache.read(db); string[] paths = { "a.", "a.b", "a/b", "a0b" }; var ents = new DirCacheEntry[paths.Length]; for (int i = 0; i < paths.Length; i++) { ents[i] = new DirCacheEntry(paths[i]); } DirCacheBuilder b = dc.builder(); for (int i = 0; i < ents.Length; i++) { b.add(ents[i]); } b.finish(); Assert.AreEqual(paths.Length, dc.getEntryCount()); dc.clear(); Assert.AreEqual(0, dc.getEntryCount()); }
public void testEmptyCache_Clear_NoCacheTree() { DirCache dc = DirCache.read(db); DirCacheTree tree = dc.getCacheTree(true); Assert.IsNotNull(tree); dc.clear(); Assert.IsNull(dc.getCacheTree(false)); Assert.AreNotSame(tree, dc.getCacheTree(true)); }
public CommitBuilder noFiles() { tree.clear(); return(this); }