diff options
| -rw-r--r-- | git.zig | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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 => {}, + } + } + } +} |
