properly handle detachted git worktrees (#5097)
commit70d78123b94d93c801171ac3dd29e2a493feee20
authorPascal Kuthe <pascal.kuthe@semimod.de>
dateSun 11 Dec 2022, 11:20 (4 years ago)
parent0e8ea13
helix-core/src/lib.rs+1−1
@@ -69,7 +69,7 @@ pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::Path
6969 top_marker = Some(ancestor);
7070 }
7171
72− if ancestor.join(".git").is_dir() {
72+ if ancestor.join(".git").exists() {
7373 // Top marker is repo root if not root marker was detected yet
7474 if top_marker.is_none() {
7575 top_marker = Some(ancestor);
helix-loader/src/grammar.rs+1−1
@@ -263,7 +263,7 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<FetchStatus> {
263263 ))?;
264264
265265 // create the grammar dir contains a git directory
266− if !grammar_dir.join(".git").is_dir() {
266+ if !grammar_dir.join(".git").exists() {
267267 git(&grammar_dir, ["init"])?;
268268 }
269269
helix-loader/src/lib.rs+1−1
@@ -97,7 +97,7 @@ pub fn find_local_config_dirs() -> Vec<PathBuf> {
9797 let mut directories = Vec::new();
9898
9999 for ancestor in current_dir.ancestors() {
100− if ancestor.join(".git").is_dir() {
100+ if ancestor.join(".git").exists() {
101101 directories.push(ancestor.to_path_buf());
102102 // Don't go higher than repo if we're in one
103103 break;
helix-term/src/ui/mod.rs+1−1
@@ -207,7 +207,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
207207
208208 // Cap the number of files if we aren't in a git project, preventing
209209 // hangs when using the picker in your home directory
210− let files: Vec<_> = if root.join(".git").is_dir() {
210+ let files: Vec<_> = if root.join(".git").exists() {
211211 files.collect()
212212 } else {
213213 // const MAX: usize = 8192;