+ 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 => {},
+ }
+ }
+ }
+}
+
+test "list blobs" {
+ var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer arena.deinit();
+ const alloc = arena.allocator();
+
+ var repo = try Repo.open(alloc, "../imgui/.git");
+ defer repo.close();
+
+ if (try repo.getObject(0xceb2b2c62d6f8f3686dcacecd5be931839b02c77)) |o| {
+ defer alloc.free(o.data);
+
+ switch (try o.parse(alloc)) {
+ .t => |t| {
+ defer t.deinit();
+ for (t.items) |treeEntry| {
+ if (try repo.getObject(treeEntry.id)) |bo| {
+ defer alloc.free(bo.data);
+
+ if (treeEntry.permissions.len == 6) {
+ std.debug.print("{s}: [{x} {}]{s}\n", .{ treeEntry.name, treeEntry.id, bo.data.len, bo.data[0..50] });
+ } else {
+ std.debug.print("[{s}]\n", .{treeEntry.name});
+ }
+ }
+ }
+ },
+ else => {},
+ }
+ }
+}
+
+test "basic frontend" {
+ var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer arena.deinit();
+ const alloc = arena.allocator();
+
+ var repo = try Repo.open(alloc, "../imgui/.git");
+ defer repo.close();
+
+ const head = try repo.getHead();