mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Ignore .git directories
This commit is contained in:
parent
e7c594262f
commit
733dc15c32
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user