private static void assertModes(string path, FileMode mode0, FileMode mode1, GitSharp.Core.TreeWalk.TreeWalk tw) { Assert.IsTrue(tw.next(), "has " + path); Assert.AreEqual(path, tw.getPathString()); Assert.AreEqual(mode0, tw.getFileMode(0)); Assert.AreEqual(mode1, tw.getFileMode(1)); }
private DirCacheEntry MakeEntry(string path, FileMode mode, String content) { var ent = new DirCacheEntry(path); ent.setFileMode(mode); byte[] contentBytes = Constants.encode(content); ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(contentBytes.Length, new MemoryStream(contentBytes))); return(ent); }
private DirCacheEntry makeEntry(string path, FileMode mode) { byte[] pathBytes = Constants.encode(path); DirCacheEntry ent = new DirCacheEntry(path); ent.setFileMode(mode); ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(pathBytes.Length, new MemoryStream(pathBytes))); return(ent); }
private static byte[] Entry(FileMode mode, string name, AnyObjectId id) { var @out = new MemoryStream(); mode.CopyTo(@out); @out.WriteByte((byte) ' '); byte[] bytes = Constants.encode(name); @out.Write(bytes, 0, bytes.Length); @out.WriteByte(0); id.copyRawTo(@out); return @out.ToArray(); }
private static byte[] Entry(FileMode mode, string name, AnyObjectId id) { var @out = new MemoryStream(); mode.CopyTo(@out); @out.WriteByte((byte)' '); byte[] bytes = Constants.encode(name); @out.Write(bytes, 0, bytes.Length); @out.WriteByte(0); id.copyRawTo(@out); return(@out.ToArray()); }
/** * Lookup an entry stored in a tree, failing if not present. * * @param tree * the tree to search. * @param path * the path to find the entry of. * @return the parsed object entry at this path, never null. * @throws AssertionFailedError * if the path does not exist in the given tree. * @throws Exception */ public RevObject get(RevTree tree, String path) { TreeWalk tw = new TreeWalk(db); tw.setFilter(PathFilterGroup.createFromStrings(new[] { path })); tw.reset(tree); while (tw.next()) { if (tw.isSubtree() && !path.Equals(tw.getPathString())) { tw.enterSubtree(); continue; } ObjectId entid = tw.getObjectId(0); FileMode entmode = tw.getFileMode(0); return(pool.lookupAny(entid, (int)entmode.ObjectType)); } Assert.Fail("Can't find " + path + " in tree " + tree.Name); return(null); // never reached. }
private DirCacheEntry MakeEntry(string path, FileMode mode, String content) { var ent = new DirCacheEntry(path); ent.setFileMode(mode); byte[] contentBytes = Constants.encode(content); ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(contentBytes.Length, new MemoryStream(contentBytes))); return ent; }
private DirCacheEntry MakeEntry(string path, FileMode mode) { return MakeEntry(path, mode, path); }
private DirCacheEntry MakeEntry(string path, FileMode mode) { return(MakeEntry(path, mode, path)); }
private static void assertModes(string path, FileMode mode0, GitSharp.Core.TreeWalk.TreeWalk tw) { Assert.IsTrue(tw.next(), "has " + path); Assert.AreEqual(path, tw.getPathString()); Assert.AreEqual(mode0, tw.getFileMode(0)); }
private DirCacheEntry makeEntry(string path, FileMode mode) { byte[] pathBytes = Constants.encode(path); DirCacheEntry ent = new DirCacheEntry(path); ent.setFileMode(mode); ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(pathBytes.Length, new MemoryStream(pathBytes))); return ent; }