authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-03 21:50:16 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-03 21:50:16 -07:00
log012efa5cb1cde301e4f5257c908b6bd58c590f87
tree5d39bc9a0bd6a1e7e4c50a531af7a960cee31d08
parent8fdfc351842785192cad01aead798d85e25d1a48
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.16.0


2 files changed, 13 insertions(+), 23 deletions(-)

README.md+1-1
......@@ -3,7 +3,7 @@
33![loc](https://sloc.xyz/github/nektro/zig-git)
44[![license](https://img.shields.io/github/license/nektro/zig-git.svg)](https://github.com/nektro/zig-git/blob/master/LICENSE)
55[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)
6[![Zig](https://img.shields.io/badge/Zig-0.15-f7a41d)](https://ziglang.org/)
6[![Zig](https://img.shields.io/badge/Zig-0.16-f7a41d)](https://ziglang.org/)
77[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
99Inspect into the depths of your .git folder purely from Zig.
git.zig+12-22
......@@ -74,7 +74,7 @@ pub fn version(alloc: std.mem.Allocator) !string {
7474 defer alloc.free(result.stdout);
7575 defer alloc.free(result.stderr);
7676 std.debug.assert(result.term == .exited and result.term.exited == 0);
77 return try alloc.dupe(u8, extras.trimPrefixEnsure(std.mem.trimRight(u8, result.stdout, "\n"), "git version ").?);
77 return try alloc.dupe(u8, extras.trimPrefixEnsure(std.mem.trimEnd(u8, result.stdout, "\n"), "git version ").?);
7878}
7979
8080/// Returns the result of running `git rev-parse HEAD`
......@@ -84,7 +84,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {
8484 const t = tracer.trace(@src(), "", .{});
8585 defer t.end();
8686
87 const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n");
87 const h = std.mem.trimEnd(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n");
8888
8989 if (std.mem.startsWith(u8, h, "ref:")) {
9090 blk: {
......@@ -95,7 +95,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {
9595 error.ENOENT => break :blk,
9696 else => |e| return e,
9797 };
98 return ensureObjId(CommitId, std.mem.trimRight(u8, reffile, "\n"));
98 return ensureObjId(CommitId, std.mem.trimEnd(u8, reffile, "\n"));
9999 }
100100 blk: {
101101 const pckedrfs = dir.readFileAlloc(alloc, "packed-refs", 1024 * 1024 * 1024) catch |err| switch (err) {
......@@ -143,7 +143,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from
143143 sub_path,
144144 });
145145 std.debug.assert(result.term == .exited and result.term.exited == 0);
146 return std.mem.trimRight(u8, result.stdout, "\n");
146 return std.mem.trimEnd(u8, result.stdout, "\n");
147147}
148148
149149// TODO make this inspect .git/objects manually
......@@ -156,7 +156,7 @@ pub fn revListAll(alloc: std.mem.Allocator, dir: nfs.Dir, from: CommitId, sub_pa
156156
157157 const result = try root.child_process.run(alloc, dir, .ignore, .pipe, .pipe, 1024 * 50, &.{ "git", "rev-list", from.id, "--", sub_path });
158158 std.debug.assert(result.term == .exited and result.term.exited == 0);
159 return std.mem.trimRight(u8, result.stdout, "\n");
159 return std.mem.trimEnd(u8, result.stdout, "\n");
160160}
161161
162162pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {
......@@ -1583,26 +1583,16 @@ fn MultiArrayList(T: type) type {
15831583 const info = @typeInfo(T).@"struct";
15841584
15851585 pub const Items = blk: {
1586 var fields: [info.fields.len]std.builtin.Type.StructField = undefined;
1586 var names: [info.fields.len][]const u8 = undefined;
1587 var types: [info.fields.len]type = undefined;
1588 var attrs: [info.fields.len]std.builtin.Type.StructField.Attributes = undefined;
15871589 for (info.fields, 0..) |f, i| {
15881590 const empty_slice: []f.type = &[_]f.type{};
1589 fields[i] = .{
1590 .name = f.name,
1591 .type = []f.type,
1592 .default_value_ptr = @ptrCast(&empty_slice),
1593 .is_comptime = false,
1594 .alignment = @alignOf(f.type),
1595 };
1591 names[i] = f.name;
1592 types[i] = f.type;
1593 attrs[i] = .{ .default_value_ptr = @ptrCast(&empty_slice) };
15961594 }
1597 const _fields = fields;
1598 break :blk @Type(.{
1599 .@"struct" = .{
1600 .layout = .auto,
1601 .fields = &_fields,
1602 .decls = &.{},
1603 .is_tuple = false,
1604 },
1605 });
1595 break :blk @Struct(.auto, null, &names, &types, &attrs);
16061596 };
16071597
16081598 pub fn deinit(self: *const Self, gpa: std.mem.Allocator) void {