| ... | @@ -193,6 +193,23 @@ pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from | ... | @@ -193,6 +193,23 @@ pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from |
| 193 | return std.mem.trimRight(u8, result.stdout, "\n"); | 193 | return std.mem.trimRight(u8, result.stdout, "\n"); |
| 194 | } | 194 | } |
| 195 | | 195 | |
| | 196 | // TODO make this inspect .git/objects manually |
| | 197 | // 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 |
| | 198 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| | 199 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| | 200 | pub fn revListAll(alloc: std.mem.Allocator, dir: nfs.Dir, from: CommitId, sub_path: string) !string { |
| | 201 | const t = tracer.trace(@src(), " {s} -- {s}", .{ from.id, sub_path }); |
| | 202 | defer t.end(); |
| | 203 | |
| | 204 | const result = try std.process.Child.run(.{ |
| | 205 | .allocator = alloc, |
| | 206 | .cwd_dir = dir.to_std(), |
| | 207 | .argv = &.{ "git", "rev-list", from.id, "--", sub_path }, |
| | 208 | }); |
| | 209 | std.debug.assert(result.term == .Exited and result.term.Exited == 0); |
| | 210 | return std.mem.trimRight(u8, result.stdout, "\n"); |
| | 211 | } |
| | 212 | |
| 196 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { | 213 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| 197 | const t = tracer.trace(@src(), "", .{}); | 214 | const t = tracer.trace(@src(), "", .{}); |
| 198 | defer t.end(); | 215 | defer t.end(); |