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 @@...@@ -3,7 +3,7 @@
3![loc](https://sloc.xyz/github/nektro/zig-git)3![loc](https://sloc.xyz/github/nektro/zig-git)
4[![license](https://img.shields.io/github/license/nektro/zig-git.svg)](https://github.com/nektro/zig-git/blob/master/LICENSE)4[![license](https://img.shields.io/github/license/nektro/zig-git.svg)](https://github.com/nektro/zig-git/blob/master/LICENSE)
5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)5[![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/)
7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
9Inspect into the depths of your .git folder purely from Zig.9Inspect 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 {...@@ -74,7 +74,7 @@ pub fn version(alloc: std.mem.Allocator) !string {
74 defer alloc.free(result.stdout);74 defer alloc.free(result.stdout);
75 defer alloc.free(result.stderr);75 defer alloc.free(result.stderr);
76 std.debug.assert(result.term == .exited and result.term.exited == 0);76 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 ").?);
78}78}
7979
80/// Returns the result of running `git rev-parse HEAD`80/// Returns the result of running `git rev-parse HEAD`
...@@ -84,7 +84,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {...@@ -84,7 +84,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {
84 const t = tracer.trace(@src(), "", .{});84 const t = tracer.trace(@src(), "", .{});
85 defer t.end();85 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
89 if (std.mem.startsWith(u8, h, "ref:")) {89 if (std.mem.startsWith(u8, h, "ref:")) {
90 blk: {90 blk: {
...@@ -95,7 +95,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {...@@ -95,7 +95,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId {
95 error.ENOENT => break :blk,95 error.ENOENT => break :blk,
96 else => |e| return e,96 else => |e| return e,
97 };97 };
98 return ensureObjId(CommitId, std.mem.trimRight(u8, reffile, "\n"));98 return ensureObjId(CommitId, std.mem.trimEnd(u8, reffile, "\n"));
99 }99 }
100 blk: {100 blk: {
101 const pckedrfs = dir.readFileAlloc(alloc, "packed-refs", 1024 * 1024 * 1024) catch |err| switch (err) {101 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...@@ -143,7 +143,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from
143 sub_path,143 sub_path,
144 });144 });
145 std.debug.assert(result.term == .exited and result.term.exited == 0);145 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");
147}147}
148148
149// TODO make this inspect .git/objects manually149// 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...@@ -156,7 +156,7 @@ pub fn revListAll(alloc: std.mem.Allocator, dir: nfs.Dir, from: CommitId, sub_pa
156156
157 const result = try root.child_process.run(alloc, dir, .ignore, .pipe, .pipe, 1024 * 50, &.{ "git", "rev-list", from.id, "--", sub_path });157 const result = try root.child_process.run(alloc, dir, .ignore, .pipe, .pipe, 1024 * 50, &.{ "git", "rev-list", from.id, "--", sub_path });
158 std.debug.assert(result.term == .exited and result.term.exited == 0);158 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");
160}160}
161161
162pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {162pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit {
...@@ -1583,26 +1583,16 @@ fn MultiArrayList(T: type) type {...@@ -1583,26 +1583,16 @@ fn MultiArrayList(T: type) type {
1583 const info = @typeInfo(T).@"struct";1583 const info = @typeInfo(T).@"struct";
15841584
1585 pub const Items = blk: {1585 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;
1587 for (info.fields, 0..) |f, i| {1589 for (info.fields, 0..) |f, i| {
1588 const empty_slice: []f.type = &[_]f.type{};1590 const empty_slice: []f.type = &[_]f.type{};
1589 fields[i] = .{1591 names[i] = f.name;
1590 .name = f.name,1592 types[i] = f.type;
1591 .type = []f.type,1593 attrs[i] = .{ .default_value_ptr = @ptrCast(&empty_slice) };
1592 .default_value_ptr = @ptrCast(&empty_slice),
1593 .is_comptime = false,
1594 .alignment = @alignOf(f.type),
1595 };
1596 }1594 }
1597 const _fields = fields;1595 break :blk @Struct(.auto, null, &names, &types, &attrs);
1598 break :blk @Type(.{
1599 .@"struct" = .{
1600 .layout = .auto,
1601 .fields = &_fields,
1602 .decls = &.{},
1603 .is_tuple = false,
1604 },
1605 });
1606 };1596 };
16071597
1608 pub fn deinit(self: *const Self, gpa: std.mem.Allocator) void {1598 pub fn deinit(self: *const Self, gpa: std.mem.Allocator) void {