当前位置: 首页>>代码示例>>C#>>正文


C# DirCacheEntry.setObjectId方法代码示例

本文整理汇总了C#中GitSharp.Core.DirectoryCache.DirCacheEntry.setObjectId方法的典型用法代码示例。如果您正苦于以下问题:C# DirCacheEntry.setObjectId方法的具体用法?C# DirCacheEntry.setObjectId怎么用?C# DirCacheEntry.setObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitSharp.Core.DirectoryCache.DirCacheEntry的用法示例。


在下文中一共展示了DirCacheEntry.setObjectId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testNonRecursiveFiltering

        public void testNonRecursiveFiltering()
        {
            var ow = new ObjectWriter(db);
            ObjectId aSth = ow.WriteBlob("a.sth".getBytes());
            ObjectId aTxt = ow.WriteBlob("a.txt".getBytes());
            DirCache dc = DirCache.read(db);
            DirCacheBuilder builder = dc.builder();
            var aSthEntry = new DirCacheEntry("a.sth");
            aSthEntry.setFileMode(FileMode.RegularFile);
            aSthEntry.setObjectId(aSth);
            var aTxtEntry = new DirCacheEntry("a.txt");
            aTxtEntry.setFileMode(FileMode.RegularFile);
            aTxtEntry.setObjectId(aTxt);
            builder.add(aSthEntry);
            builder.add(aTxtEntry);
            builder.finish();
            ObjectId treeId = dc.writeTree(ow);


            var tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            tw.setFilter(PathSuffixFilter.create(".txt"));
            tw.addTree(treeId);

            var paths = new LinkedList<string>();
            while (tw.next())
            {
                paths.AddLast(tw.getPathString());
            }

            var expected = new LinkedList<string>();
            expected.AddLast("a.txt");

            Assert.AreEqual(expected, paths);
        }
开发者ID:dev218,项目名称:GitSharp,代码行数:34,代码来源:PathSuffixFilterTestCase.cs

示例2: MakeEntry

 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;
 }
开发者ID:georgeck,项目名称:GitSharp,代码行数:8,代码来源:SimpleMergeTest.cs

示例3: makeFile

 private DirCacheEntry makeFile(string path)
 {
     byte[] pathBytes = Constants.encode(path);
     var ent = new DirCacheEntry(path);
     ent.setFileMode(FileMode.RegularFile);
     ent.setObjectId(new ObjectWriter(db).ComputeBlobSha1(pathBytes.Length, new MemoryStream(pathBytes)));
     return ent;
 }
开发者ID:jagregory,项目名称:GitSharp,代码行数:8,代码来源:PostOrderTreeWalkTest.cs


注:本文中的GitSharp.Core.DirectoryCache.DirCacheEntry.setObjectId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。