Change summary
zed/src/worktree.rs | 2 ++
zed/src/worktree/ignore.rs | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
Detailed changes
@@ -1423,10 +1423,12 @@ mod tests {
app.read(|ctx| tree.read(ctx).next_scan_complete()).await;
app.read(|ctx| {
let tree = tree.read(ctx);
+ let dot_git = tree.entry_for_path(".git").unwrap();
let tracked = tree.entry_for_path("tracked-dir/tracked-file2").unwrap();
let ignored = tree.entry_for_path("ignored-dir/ignored-file2").unwrap();
assert_eq!(tracked.is_ignored(), false);
assert_eq!(ignored.is_ignored(), true);
+ assert_eq!(dot_git.is_ignored(), true);
});
});
}
@@ -1,6 +1,5 @@
-use std::{path::Path, sync::Arc};
-
use ignore::gitignore::Gitignore;
+use std::{ffi::OsStr, path::Path, sync::Arc};
pub enum IgnoreStack {
None,
@@ -37,6 +36,10 @@ impl IgnoreStack {
}
pub fn is_path_ignored(&self, path: &Path, is_dir: bool) -> bool {
+ if is_dir && path.file_name() == Some(OsStr::new(".git")) {
+ return true;
+ }
+
match self {
Self::None => false,
Self::All => true,