| ... | @@ -134,7 +134,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 { | ... | @@ -134,7 +134,7 @@ pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 { |
| 134 | // TODO make this inspect .git manually | 134 | // TODO make this inspect .git manually |
| 135 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects | 135 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 136 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | 136 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 137 | pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !?bool { | 137 | pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree.Object.Id.Tag) !bool { |
| 138 | const t = tracer.trace(@src(), " {s} = {s} ?", .{ maybeobj, @tagName(typ) }); | 138 | const t = tracer.trace(@src(), " {s} = {s} ?", .{ maybeobj, @tagName(typ) }); |
| 139 | defer t.end(); | 139 | defer t.end(); |
| 140 | | 140 | |
| ... | @@ -143,7 +143,7 @@ pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree | ... | @@ -143,7 +143,7 @@ pub fn isType(alloc: std.mem.Allocator, dir: std.fs.Dir, maybeobj: Id, typ: Tree |
| 143 | .cwd_dir = dir, | 143 | .cwd_dir = dir, |
| 144 | .argv = &.{ "git", "cat-file", "-t", maybeobj }, | 144 | .argv = &.{ "git", "cat-file", "-t", maybeobj }, |
| 145 | }); | 145 | }); |
| 146 | if (result.term != .Exited or result.term.Exited != 0) return null; | 146 | std.debug.assert(result.term == .Exited and result.term.Exited == 0); |
| 147 | const output = std.mem.trimRight(u8, result.stdout, "\n"); | 147 | const output = std.mem.trimRight(u8, result.stdout, "\n"); |
| 148 | return std.meta.stringToEnum(Tree.Object.Id.Tag, output).? == typ; | 148 | return std.meta.stringToEnum(Tree.Object.Id.Tag, output).? == typ; |
| 149 | } | 149 | } |
| ... | @@ -739,7 +739,7 @@ pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref { | ... | @@ -739,7 +739,7 @@ pub fn getTags(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const Ref { |
| 739 | extras.assertLog(std.mem.endsWith(u8, label2, "^{}"), "{s}", .{label2}); | 739 | extras.assertLog(std.mem.endsWith(u8, label2, "^{}"), "{s}", .{label2}); |
| 740 | std.debug.assert(std.mem.eql(u8, label, extras.trimSuffixEnsure(label2, "^{}").?)); | 740 | std.debug.assert(std.mem.eql(u8, label, extras.trimSuffixEnsure(label2, "^{}").?)); |
| 741 | // extras.assertLog(try isType(alloc, dir, id2, .commit), id2); // linux kernel has a single tag that points at a tree | 741 | // 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; |
| 743 | | 743 | |
| 744 | try list.append(Ref{ | 744 | try list.append(Ref{ |
| 745 | .label = label, | 745 | .label = label, |