mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 19:54:10 +03:00
Revert search in gitignored files in file finder
This commit is contained in:
parent
db22babe2a
commit
e6573e9055
@ -352,10 +352,15 @@ impl FileFinderDelegate {
|
|||||||
let include_root_name = worktrees.len() > 1;
|
let include_root_name = worktrees.len() > 1;
|
||||||
let candidate_sets = worktrees
|
let candidate_sets = worktrees
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|worktree| PathMatchCandidateSet {
|
.map(|worktree| {
|
||||||
snapshot: worktree.read(cx).snapshot(),
|
let worktree = worktree.read(cx);
|
||||||
include_ignored: true,
|
PathMatchCandidateSet {
|
||||||
include_root_name,
|
snapshot: worktree.snapshot(),
|
||||||
|
include_ignored: worktree
|
||||||
|
.root_entry()
|
||||||
|
.map_or(false, |entry| entry.is_ignored),
|
||||||
|
include_root_name,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
@ -1202,7 +1207,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_ignored_root(cx: &mut TestAppContext) {
|
async fn test_ignored_files(cx: &mut TestAppContext) {
|
||||||
let app_state = init_test(cx);
|
let app_state = init_test(cx);
|
||||||
app_state
|
app_state
|
||||||
.fs
|
.fs
|
||||||
@ -1245,94 +1250,7 @@ mod tests {
|
|||||||
picker.delegate.spawn_search(test_path_like("hi"), cx)
|
picker.delegate.spawn_search(test_path_like("hi"), cx)
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
picker.update(cx, |picker, _| {
|
picker.update(cx, |picker, _| assert_eq!(picker.delegate.matches.len(), 7));
|
||||||
assert_eq!(
|
|
||||||
collect_search_results(picker),
|
|
||||||
vec![
|
|
||||||
PathBuf::from("ignored-root/happiness"),
|
|
||||||
PathBuf::from("ignored-root/height"),
|
|
||||||
PathBuf::from("ignored-root/hi"),
|
|
||||||
PathBuf::from("ignored-root/hiccup"),
|
|
||||||
PathBuf::from("tracked-root/happiness"),
|
|
||||||
PathBuf::from("tracked-root/height"),
|
|
||||||
PathBuf::from("tracked-root/hi"),
|
|
||||||
PathBuf::from("tracked-root/hiccup"),
|
|
||||||
],
|
|
||||||
"All files in all roots (including gitignored) should be searched"
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#[gpui::test]
|
|
||||||
async fn test_ignored_files(cx: &mut TestAppContext) {
|
|
||||||
let app_state = init_test(cx);
|
|
||||||
app_state
|
|
||||||
.fs
|
|
||||||
.as_fake()
|
|
||||||
.insert_tree(
|
|
||||||
"/root",
|
|
||||||
json!({
|
|
||||||
".git": {},
|
|
||||||
".gitignore": "ignored_a\n.env\n",
|
|
||||||
"a": {
|
|
||||||
"banana_env": "11",
|
|
||||||
"bandana_env": "12",
|
|
||||||
},
|
|
||||||
"ignored_a": {
|
|
||||||
"ignored_banana_env": "21",
|
|
||||||
"ignored_bandana_env": "22",
|
|
||||||
"ignored_nested": {
|
|
||||||
"ignored_nested_banana_env": "31",
|
|
||||||
"ignored_nested_bandana_env": "32",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
".env": "something",
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
|
|
||||||
|
|
||||||
let (picker, workspace, cx) = build_find_picker(project, cx);
|
|
||||||
|
|
||||||
cx.simulate_input("env");
|
|
||||||
picker.update(cx, |picker, _| {
|
|
||||||
assert_eq!(
|
|
||||||
collect_search_results(picker),
|
|
||||||
vec![
|
|
||||||
PathBuf::from(".env"),
|
|
||||||
PathBuf::from("a/banana_env"),
|
|
||||||
PathBuf::from("a/bandana_env"),
|
|
||||||
],
|
|
||||||
"Root gitignored files and all non-gitignored files should be searched"
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
let _ = workspace
|
|
||||||
.update(cx, |workspace, cx| {
|
|
||||||
workspace.open_abs_path(
|
|
||||||
PathBuf::from("/root/ignored_a/ignored_banana_env"),
|
|
||||||
true,
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
cx.run_until_parked();
|
|
||||||
cx.simulate_input("env");
|
|
||||||
picker.update(cx, |picker, _| {
|
|
||||||
assert_eq!(
|
|
||||||
collect_search_results(picker),
|
|
||||||
vec![
|
|
||||||
PathBuf::from(".env"),
|
|
||||||
PathBuf::from("a/banana_env"),
|
|
||||||
PathBuf::from("a/bandana_env"),
|
|
||||||
PathBuf::from("ignored_a/ignored_banana_env"),
|
|
||||||
PathBuf::from("ignored_a/ignored_bandana_env"),
|
|
||||||
],
|
|
||||||
"Root gitignored dir got listed and its entries got into worktree, but all gitignored dirs below it were not listed. Old entries + new listed gitignored entries should be searched"
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user