blob: 5a9e47fe62f161e7c6bb45965ec475d928c579d8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using LibGit;
namespace LibGitTest;
public class Test4
{
public static async Task Run()
{
Console.WriteLine("Test4 running");
var repo = new GitRepo(new FileRepoSource(@"/home/Rory/git/spacebar/server-master/.git"));
var packs = repo.GetPacks().GetAsyncEnumerator();
int count = 0;
if (Directory.Exists("out-git"))
Directory.Delete("out-git", true);
Directory.CreateDirectory("out-git");
Directory.CreateDirectory("out-git/objects");
while (await packs.MoveNextAsync())
{
count += packs.Current.ObjectCount;
foreach (var gitPackObject in packs.Current.Index.Entries)
{
var item = packs.Current.Objects.First(x => x.Offset == gitPackObject.Offset);
Console.WriteLine($"{item.ObjType}");
}
}
Console.WriteLine($"Read {count} objects from pack files.");
}
}
|