authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-01-31 13:35:35 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-01-31 13:35:35 -08:00
log174944517fd98f8831c5f5aa9738f880fe00ac4d
treef6651db1f8aad31a813ea02cae5a6747d1157dea
parentc72a3e29f201a301452f16ae323e168c8fbed13e

remove optional from isType return


1 files changed, 3 insertions(+), 3 deletions(-)

git.zig+3-3
......@@ -134,7 +134,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 {
134134// TODO make this inspect .git manually
135135// https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
136136// https://git-scm.com/book/en/v2/Git-Internals-Packfiles
137pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !?bool {
137pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !bool {
138138 const t = tracer.trace(@src(), " {s} = {s} ?", .{ maybeobj, @tagName(typ) });
139139 defer t.end();
140140
......@@ -143,7 +143,7 @@ pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree
143143 .cwd_dir = dir,
144144 .argv = &.{ "git", "cat-file", "-t", maybeobj },
145145 });
146 if (result.term != .Exited or result.term.Exited != 0) return null;
146 std.debug.assert(result.term == .Exited and result.term.Exited == 0);
147147 const output = std.mem.trimRight(u8, result.stdout, "\n");
148148 return std.meta.stringToEnum(Tree.Object.Id.Tag, output).? == typ;
149149}
......@@ -739,7 +739,7 @@ pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref {
739739 extras.assertLog(std.mem.endsWith(u8, label2, "^{}"), "{s}", .{label2});
740740 std.debug.assert(std.mem.eql(u8, label, extras.trimSuffixEnsure(label2, "^{}").?));
741741 // extras.assertLog(try isType(alloc, dir, id2, .commit), id2); // linux kernel has a single tag that points at a tree
742 if (!(try isType(alloc, dir, id2, .commit)).?) continue;
742 if (!try isType(alloc, dir, id2, .commit)) continue;
743743
744744 try list.append(Ref{
745745 .label = label,