summary refs log tree commit diff
path: root/LibGitTest
diff options
context:
space:
mode:
Diffstat (limited to 'LibGitTest')
-rw-r--r--LibGitTest/LibGitTest.csproj1
-rw-r--r--LibGitTest/Program.cs7
-rw-r--r--LibGitTest/Test1.cs2
-rw-r--r--LibGitTest/Test3.cs2
-rw-r--r--LibGitTest/Test4.cs29
5 files changed, 35 insertions, 6 deletions
diff --git a/LibGitTest/LibGitTest.csproj b/LibGitTest/LibGitTest.csproj

index fddc46c..5f1d18e 100644 --- a/LibGitTest/LibGitTest.csproj +++ b/LibGitTest/LibGitTest.csproj
@@ -5,6 +5,7 @@ <TargetFramework>net10.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> + <PublishAOT>true</PublishAOT> </PropertyGroup> <ItemGroup> diff --git a/LibGitTest/Program.cs b/LibGitTest/Program.cs
index 3d87631..18459c7 100644 --- a/LibGitTest/Program.cs +++ b/LibGitTest/Program.cs
@@ -1,11 +1,10 @@ // See https://aka.ms/new-console-template for more information -using LibGit; -using LibGit.Extensions; using LibGitTest; Console.WriteLine("Hello, World!"); -//await Test1.Run(); +// await Test1.Run(); //await Test2.Run(); -await Test3.Run(); \ No newline at end of file +// await Test3.Run(); +await Test4.Run(); \ No newline at end of file diff --git a/LibGitTest/Test1.cs b/LibGitTest/Test1.cs
index ebd6f7e..71de9df 100644 --- a/LibGitTest/Test1.cs +++ b/LibGitTest/Test1.cs
@@ -8,7 +8,7 @@ public class Test1 public static async Task Run() { Console.WriteLine("Test1 running"); - var repo = new GitRepo(new FileRepoSource(@"/home/Rory/git/matrix/MatrixRoomUtils.git")); + var repo = new GitRepo(new FileRepoSource(@"/home/Rory/git/spacebar/server-master/.git")); // var repo = new GitRepo(new WebRepoSource("https://git.rory.gay/MatrixRoomUtils.git/")); var commit = await repo.GetCommit("HEAD"); diff --git a/LibGitTest/Test3.cs b/LibGitTest/Test3.cs
index 24d6986..fee7230 100644 --- a/LibGitTest/Test3.cs +++ b/LibGitTest/Test3.cs
@@ -7,7 +7,7 @@ public class Test3 public static async Task Run() { Console.WriteLine("Test3 running"); - var repo = new GitRepo(new FileRepoSource(@"/home/Rory/git/spacebar/server-master/.git")); + var repo = new GitRepo(new FileRepoSource(@"/home/Rory/git/nixpkgs-Draupnir/.git")); var packs = repo.GetPacks().GetAsyncEnumerator(); int count = 0; while(await packs.MoveNextAsync()) 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