authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-10-19 14:31:43+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-10-23 01:01:37-04:00
log4b48fccaddd2f8f840f34779c07ad1fa634d09c5
treea2cf1445c8369a00c0eca60dad803aebd3e10e66
parent3af9025a1d4f99c0c36f605c4aa0ea7b52a97aca

When checking a cache hit, make sure to handle a (re)moved source file

When a file cannot be found in the cache, it is not a hit. Closes #6729

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

src/Cache.zig+3-2
......@@ -315,8 +315,9 @@ pub const Manifest = struct {
315315 cache_hash_file.path = try self.cache.gpa.dupe(u8, file_path);
316316 }
317317
318 const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch {
319 return error.CacheUnavailable;
318 const this_file = fs.cwd().openFile(cache_hash_file.path.?, .{ .read = true }) catch |err| switch (err) {
319 error.FileNotFound => return false,
320 else => return error.CacheUnavailable,
320321 };
321322 defer this_file.close();
322323