From c0e771f7739fdb45d4ab955d7c2f3409c818eb00 Mon Sep 17 00:00:00 2001 From: Benjamin Nguyen Date: Sun, 25 Jun 2023 22:12:35 -0700 Subject: [PATCH 1/2] Don't do a full traversal if depth is limited to 1 and size is suppressed --- src/tree/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tree/mod.rs b/src/tree/mod.rs index da18aab7..8c0e2291 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()?); From 35be382d7baa035694044e8ec77f97e915806511 Mon Sep 17 00:00:00 2001 From: Benjamin Nguyen Date: Sun, 25 Jun 2023 22:37:10 -0700 Subject: [PATCH 2/2] fmt --- src/tree/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tree/mod.rs b/src/tree/mod.rs index 8c0e2291..9ce6f4aa 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -439,9 +439,7 @@ impl TryFrom<&Context> for WalkParallel { .threads(ctx.threads); if ctx.suppress_size && ctx.level() == 1 { - builder - .max_depth(Some(1)) - .threads(1); + builder.max_depth(Some(1)).threads(1); } if ctx.pattern.is_some() {