本文整理汇总了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);
}
示例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;
}
示例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;
}