summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Nguyen <benjamin.van.nguyen@gmail.com>2023-06-25 22:12:35 -0700
committerBenjamin Nguyen <benjamin.van.nguyen@gmail.com>2023-06-25 22:12:35 -0700
commitc0e771f7739fdb45d4ab955d7c2f3409c818eb00 (patch)
tree7b10a148488d9f3904f0514dd7a580b491031366
parentc42784fca103f9d20bb219e3c5199d037f2b2125 (diff)
Don't do a full traversal if depth is limited to 1 and size is suppressed
-rw-r--r--src/tree/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tree/mod.rs b/src/tree/mod.rs
index da18aab..8c0e229 100644
--- a/src/tree/mod.rs
+++ b/src/tree/mod.rs
@@ -438,6 +438,12 @@ impl TryFrom<&Context> for WalkParallel {
.overrides(ctx.no_git_override()?)
.threads(ctx.threads);
+ if ctx.suppress_size && ctx.level() == 1 {
+ builder
+ .max_depth(Some(1))
+ .threads(1);
+ }
+
if ctx.pattern.is_some() {
if ctx.glob || ctx.iglob {
builder.filter_entry(ctx.glob_predicate()?);