| ... | ... | @@ -53,6 +53,18 @@ pub fn getObject(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !string { |
| 53 | 53 | return std.mem.trimRight(u8, result.stdout, "\n"); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | // TODO make this inspect .git/objects manually |
| 57 | // https://git-scm.com/book/en/v2/Git-Internals-Git-Objects |
| 58 | // https://git-scm.com/book/en/v2/Git-Internals-Packfiles |
| 59 | pub fn getObjectSize(alloc: std.mem.Allocator, dir: std.fs.Dir, obj: Id) !u64 { |
| 60 | const result = try std.ChildProcess.exec(.{ |
| 61 | .allocator = alloc, |
| 62 | .cwd_dir = dir, |
| 63 | .argv = &.{ "git", "cat-file", "-s", obj }, |
| 64 | }); |
| 65 | return try std.fmt.parseInt(u64, std.mem.trimRight(u8, result.stdout, "\n"), 10); |
| 66 | } |
| 67 | |
| 56 | 68 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| 57 | 69 | var iter = std.mem.split(u8, commitfile, "\n"); |
| 58 | 70 | var result: Commit = undefined; |