commit: 72aee1e5828f32f7b36479474e496492e82cc270
parent ff31ed5e266194af50dcf07fccb6b9c6567ec8b1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 5 Jul 2022 08:01:27 +0200
Drop broken caching of exclusion status
The variable was shared between all the files in the same directory, the
cached status should probably be only given for a subdirectory but we can also
just drop the thing altogether as it's a bit of a premature optimisation.
Diffstat:
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/main.ha b/main.ha
@@ -72,7 +72,7 @@ fn is_excluded(filename: str) bool = {
return false;
};
-fn check_dir(dirname: str, ignoring: bool) (void | errors::invalid) = {
+fn check_dir(dirname: str) (void | errors::invalid) = {
const iter = match (os::iter(dirname)) {
case let iter: *fs::iterator =>
yield iter;
@@ -97,12 +97,8 @@ fn check_dir(dirname: str, ignoring: bool) (void | errors::invalid) = {
const filename = path::join(dirname, ent.name);
defer free(filename);
- if (!ignoring) {
- ignoring = is_excluded(filename);
- };
-
if (fs::isdir(ent.ftype)) {
- check_dir(filename, ignoring)?;
+ check_dir(filename)?;
} else if(fs::isfile(ent.ftype)) {
const is_blob = match (is_blob(filename)) {
case let b: bool =>
@@ -121,7 +117,7 @@ fn check_dir(dirname: str, ignoring: bool) (void | errors::invalid) = {
continue;
};
- if (ignoring) {
+ if (is_excluded(filename)) {
fmt::printfln("ignoring: {}", filename)!;
continue;
};
@@ -157,7 +153,7 @@ fn check_dir(dirname: str, ignoring: bool) (void | errors::invalid) = {
fmt::fatalf("os::readdir({}): {}", dirname, fs::strerror(e));
};
- const ret = check_dir(dirname, false);
+ const ret = check_dir(dirname);
assert(ret is void);
const files_after = match (os::readdir(dirname)) {
@@ -201,7 +197,7 @@ export fn main() void = {
fmt::println(":: Checking for blobs")!;
- const ret = check_dir(".", false);
+ const ret = check_dir(".");
fmt::println(":: Done checking for blobs")!;