From 7ecc6f1226d8670e9f165c1a18d2d5a2b8cf6db3 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Mon, 15 Jan 2024 21:11:17 +0000 Subject: [PATCH 1/2] feat: don't require a git directory to use .gitignore files When we are searching we don't want to have to initialize git repo to use a .gitignore file. This should just ignore any file in a .gitignore always --- rust/finder.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/finder.rs b/rust/finder.rs index f77d55d..2e577c6 100644 --- a/rust/finder.rs +++ b/rust/finder.rs @@ -10,7 +10,11 @@ pub fn find_files(options: Options) -> Vec { let base_path = &fs::canonicalize(options.directory).unwrap(); let mut builder = WalkBuilder::new(base_path); + // Search for hidden files and directories builder.hidden(false); + // Don't require a git repo to use .gitignore files. We want to use the .gitignore files + // wherever we are + builder.require_git(false); // TODO(ade): Remove unwraps and find a good way to get the errors into the UI. Currently there // is no way to handel errors in the rust library From fc58dd31d82fbd6752c328d4db94fed109622ab9 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Wed, 17 Jan 2024 21:11:12 +0000 Subject: [PATCH 2/2] feat: don't search in sapling source control directories This file should be treated as the .git dir and not show up in the candidates list for files. --- rust/finder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/finder.rs b/rust/finder.rs index 2e577c6..f3baa97 100644 --- a/rust/finder.rs +++ b/rust/finder.rs @@ -20,6 +20,7 @@ pub fn find_files(options: Options) -> Vec { // is no way to handel errors in the rust library let mut override_builder = OverrideBuilder::new(""); override_builder.add("!.git").unwrap(); + override_builder.add("!.sl").unwrap(); let overrides = override_builder.build().unwrap(); builder.overrides(overrides);