public void WalkCommits() { using var repo = GitRepository.Open(typeof(GitRepositoryTests).Assembly.Location); foreach (var c in repo.Commits.Take(20)) { TestContext.WriteLine($"Commit {c.Id:x8} - {GitTools.FirstLine(c.Message)}"); if (c.Parent != null) { TestContext.WriteLine($" -parent {c.Parent?.Id} - {GitTools.FirstLine(c.Parent?.Message)}"); } TestContext.WriteLine($" -tree {c.Tree?.Id}"); foreach (var v in c.Tree !) { TestContext.WriteLine($" - {v.Name}"); } } }
public async Task WalkCommitsAsync() { using var repo = GitRepository.Open(typeof(GitRepositoryTests).Assembly.Location); await foreach (var c in repo.Commits.Take(20)) { TestContext.WriteLine($"Commit {c.Id:x10} - {GitTools.FirstLine(c.Message)}"); TestContext.WriteLine($"Author: {c.Author?.ToString() ?? "-"}"); if (c.Parent != null) { TestContext.WriteLine($" -parent {c.Parent?.Id} - {GitTools.FirstLine(c.Parent?.Message)}"); } TestContext.WriteLine($" -tree {c.Tree.Id}"); foreach (var v in c.Tree) { TestContext.WriteLine($" - {v.Name}"); } } }
public async Task WalkCommitsViaObjectRepository() { using var repo = GitRepository.Open(typeof(GitRepositoryTests).Assembly.Location); //GC.KeepAlive(repo.Configuration.Identity); await foreach (var c in repo.ObjectRepository.GetAll <GitCommit>(new HashSet <GitId>())) { TestContext.WriteLine($"Commit {c.Id} - {GitTools.FirstLine(c.Message)}"); if (c.Parent != null) { TestContext.WriteLine($" -parent {c.Parent?.Id} - {GitTools.FirstLine(c.Parent?.Message)}"); } TestContext.WriteLine($" -tree {c.Tree?.Id}"); foreach (var v in c.Tree !) { TestContext.WriteLine($" - {v.Name}"); } } }