Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
		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();
		}
Exemplo n.º 5
0
        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());
        }
Exemplo n.º 6
0
        /**
         * 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.
        }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 private DirCacheEntry MakeEntry(string path, FileMode mode)
 {
     return MakeEntry(path, mode, path);
 }
Exemplo n.º 9
0
 private DirCacheEntry MakeEntry(string path, FileMode mode)
 {
     return(MakeEntry(path, mode, path));
 }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
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;
		}