| ... | @@ -124,26 +124,6 @@ pub fn ensureObjId(comptime T: type, input: string) T { | ... | @@ -124,26 +124,6 @@ pub fn ensureObjId(comptime T: type, input: string) T { |
| 124 | return .{ .id = input[0..40] }; | 124 | return .{ .id = input[0..40] }; |
| 125 | } | 125 | } |
| 126 | | 126 | |
| 127 | // TODO make this inspect .git/objects manually | | |
| 128 | // TODO make a version of this that accepts an array of sub_paths and searches all of them at once, so as to not lose spot in history when searching for many old paths | | |
| 129 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects | | |
| 130 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles | | |
| 131 | pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from: CommitId, sub_path: string) !string { | | |
| 132 | const t = tracer.trace(@src(), "({d}) {s} -- {s}", .{ count, from.id, sub_path }); | | |
| 133 | defer t.end(); | | |
| 134 | | | |
| 135 | const result = try root.child_process.run(alloc, dir, .ignore, .pipe, .pipe, 1024 * 1024 * 10, &.{ | | |
| 136 | "git", | | |
| 137 | "rev-list", | | |
| 138 | "-" ++ std.fmt.comptimePrint("{d}", .{count}), | | |
| 139 | from.id, | | |
| 140 | "--", | | |
| 141 | sub_path, | | |
| 142 | }); | | |
| 143 | std.debug.assert(result.term == .exited and result.term.exited == 0); | | |
| 144 | return std.mem.trimEnd(u8, result.stdout, "\n"); | | |
| 145 | } | | |
| 146 | | | |
| 147 | // TODO make this inspect .git/objects manually | 127 | // TODO make this inspect .git/objects manually |
| 148 | // TODO make a version of this that accepts an array of sub_paths and searches all of them at once, so as to not lose spot in history when searching for many old paths | 128 | // TODO make a version of this that accepts an array of sub_paths and searches all of them at once, so as to not lose spot in history when searching for many old paths |
| 149 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects | 129 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |