file_finder: Respect .gitignore and file_scan_inclusions with ** in glob (#40654)
Closes #39037 Previously, the code split the `**/.env` glob in `file_scan_inclusions` into two sources for the `PathMatcher`: `["**", "**/.env"]`. This approach works for directories, but including `**` will match all directories and their files. To address this, I now select the appropriate `PathMatcher` using only `**/.env` when specifically targeting a file to determine whether to include it in the file finder. Release Notes: - Fixed: respect `.gitignore` and `file_scan_inclusions` settings with `**` in glob for file finder --------- Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com> Co-authored-by: Julia Ryan <juliaryan3.14@gmail.com>
This commit is contained in:
co-authored by
Julia Ryan
parent
cc6208b17f
commit
a827f25d00
@@ -1573,6 +1573,21 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[perf]
|
||||
fn file_in_dirs() {
|
||||
let path = Path::new("/work/.env");
|
||||
let path_matcher = PathMatcher::new(&["**/.env".to_owned()], PathStyle::Posix).unwrap();
|
||||
assert!(
|
||||
path_matcher.is_match(path),
|
||||
"Path matcher should match {path:?}"
|
||||
);
|
||||
let path = Path::new("/work/package.json");
|
||||
assert!(
|
||||
!path_matcher.is_match(path),
|
||||
"Path matcher should not match {path:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[perf]
|
||||
fn project_search() {
|
||||
let path = Path::new("/Users/someonetoignore/work/zed/zed.dev/node_modules");
|
||||
|
||||
Reference in New Issue
Block a user