authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:53:51 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:53:51 -07:00
log3cffae7e763459d00316e73c623cab10a03dab95
tree6ad5bd97854b99d2251caf33a47d192f3dd79000
parent55a0abba1dea88b5cb4c05c203bbb87a6c856678

util.git_rev_HEAD: max alloc len to 50


1 files changed, 2 insertions(+), 3 deletions(-)

src/util/funcs.zig+2-3
...@@ -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
231231
232/// Returns the result of running `git rev-parse HEAD`232/// Returns the result of running `git rev-parse HEAD`
233pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string {233pub 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}
240239