Add handling of git's core.excludesFile (#33592)
Taking over from #28314. Part of https://github.com/zed-industries/zed/issues/4824 Co-authored-by: Paul Nameless <reacsdas@gmail.com> Release Notes: - Zed now respects git's `core.excludesFile` (~/.config/git/ignore) in addition to .gitignore. --------- Co-authored-by: Paul Nameless <reacsdas@gmail.com>
This commit is contained in:
co-authored by
Paul Nameless
parent
b60e705782
commit
45ee1327a4
@@ -520,3 +520,16 @@ fn add_vscode_user_data_paths(paths: &mut Vec<PathBuf>, product_name: &str) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn global_gitignore_path() -> Option<PathBuf> {
|
||||
Some(home_dir().join(".config").join("git").join("ignore"))
|
||||
}
|
||||
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
pub fn global_gitignore_path() -> Option<PathBuf> {
|
||||
static GLOBAL_GITIGNORE_PATH: OnceLock<Option<PathBuf>> = OnceLock::new();
|
||||
GLOBAL_GITIGNORE_PATH
|
||||
.get_or_init(::ignore::gitignore::gitconfig_excludes_path)
|
||||
.clone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user