| ... | ... | @@ -14,7 +14,10 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !Id { |
| 14 | 14 | |
| 15 | 15 | if (std.mem.startsWith(u8, h, "ref:")) { |
| 16 | 16 | const r = blk: { |
| 17 | | const pckedrfs = try dir.readFileAlloc(alloc, "packed-refs", 1024 * 1024); |
| 17 | const pckedrfs = dir.readFileAlloc(alloc, "packed-refs", 1024 * 1024) catch |err| switch (err) { |
| 18 | error.FileNotFound => try std.fs.cwd().readFileAlloc(alloc, "/dev/null", 1024), |
| 19 | else => |e| return e, |
| 20 | }; |
| 18 | 21 | var iter = std.mem.split(u8, pckedrfs, "\n"); |
| 19 | 22 | while (iter.next()) |line| { |
| 20 | 23 | if (std.mem.startsWith(u8, line, "#")) continue; |