X-Git-Url: https://gitweb.ps.run/ziggit/blobdiff_plain/f8e639c5f6c9ce6eb04a851cc3d90dce8f71cf4f..082dd5cd1782d1a384217bcfe309910c4df459b0:/git.zig diff --git a/git.zig b/git.zig index 22bdf5d..27081a2 100644 --- a/git.zig +++ b/git.zig @@ -546,3 +546,27 @@ test "list blobs" { } } } + +test "basic frontend" { + const alloc = std.testing.allocator; + var repo = try Repo.open(alloc, "../imgui/.git"); + defer repo.close(); + + const head = try repo.getHead(); + + var id = head; + + for (0..3) |_| { + if (try repo.getObject(id)) |o| { + defer alloc.free(o.data); + + switch (try o.parse(alloc)) { + .c => |c| { + std.debug.print("commit {x}:\n tree: {x}\n parent: {x}\n author: {s}\n committer: {s}\n message: {s}\n", .{ id, c.tree, c.parent, c.author, c.committer, c.message }); + id = c.parent; + }, + else => {}, + } + } + } +}