| ... | @@ -231,10 +231,9 @@ pub fn do_hash(alloc: std.mem.Allocator, comptime algo: type, data: string) !str | ... | @@ -231,10 +231,9 @@ pub fn do_hash(alloc: std.mem.Allocator, comptime algo: type, data: string) !str |
| 231 | | 231 | |
| 232 | /// Returns the result of running `git rev-parse HEAD` | 232 | /// Returns the result of running `git rev-parse HEAD` |
| 233 | pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string { | 233 | pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string { |
| 234 | const max = std.math.maxInt(usize); | | |
| 235 | const dirg = try dir.openDir(".git", .{}); | 234 | const dirg = try dir.openDir(".git", .{}); |
| 236 | const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", max), "\n"); | 235 | const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", 50), "\n"); |
| 237 | const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], max), "\n"); | 236 | const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], 50), "\n"); |
| 238 | return r; | 237 | return r; |
| 239 | } | 238 | } |
| 240 | | 239 | |