authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-29 10:09:40-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-29 10:09:40-07:00
logbdb3b382d8f39ec1e38a72c473963381a065da0c
treea11776ed7efa4d2bd785c0287acc1845cd6d1e1f
parentd750a78b2c0265bd7bb2b924c4c739cad5aa6666

zig fmt: ignore hidden files and directories

rather than ignoring specifically "zig-cache" and "zig-out". The latter is not necessarily the install prefix and should not be special. The former will be handled by renaming zig-cache to .zig-cache.

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

lib/compiler/fmt.zig+1-1
...@@ -236,7 +236,7 @@ fn fmtPathDir(...@@ -236,7 +236,7 @@ fn fmtPathDir(
236 while (try dir_it.next()) |entry| {236 while (try dir_it.next()) |entry| {
237 const is_dir = entry.kind == .directory;237 const is_dir = entry.kind == .directory;
238238
239 if (is_dir and (mem.eql(u8, entry.name, "zig-cache") or mem.eql(u8, entry.name, "zig-out"))) continue;239 if (mem.startsWith(u8, entry.name, ".")) continue;
240240
241 if (is_dir or entry.kind == .file and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) {241 if (is_dir or entry.kind == .file and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) {
242 const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name });242 const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name });