| ... | @@ -10,6 +10,7 @@ pub const BlobId = struct { id: Id }; | ... | @@ -10,6 +10,7 @@ pub const BlobId = struct { id: Id }; |
| 10 | | 10 | |
| 11 | /// Returns the result of running `git rev-parse HEAD` | 11 | /// Returns the result of running `git rev-parse HEAD` |
| 12 | /// dir must already be pointing at the .git folder | 12 | /// dir must already be pointing at the .git folder |
| | 13 | // TODO this doesnt handle when there are 0 commits |
| 13 | pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !Id { | 14 | pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !Id { |
| 14 | const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n"); | 15 | const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n"); |
| 15 | | 16 | |