summary refs log tree commit diff
path: root/LibGitTest/Test4.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-12 20:28:15 +0100
committerRory& <root@rory.gay>2025-12-12 20:28:15 +0100
commitd65325f1298bc456824dc68e5d34a4ac0d686e42 (patch)
tree6d7445236bf34c1c2b380bae511e227a6fefb2bc /LibGitTest/Test4.cs
parentread indexes and packs correctly (diff)
downloadGitTools-master.tar.xz
Use bulk reads and more intrinsics HEAD master
Diffstat (limited to 'LibGitTest/Test4.cs')
-rw-r--r--LibGitTest/Test4.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/LibGitTest/Test4.cs b/LibGitTest/Test4.cs
new file mode 100644

index 0000000..5a9e47f --- /dev/null +++ b/LibGitTest/Test4.cs
@@ -0,0 +1,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."); + } +} \ No newline at end of file