on master help sign in
properly handle detachted git worktrees (#5097)
70d7812Pascal Kuthe
helix-core/src/lib.rs+1−1
@@ -69,7 +69,7 @@ pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::Path
69 top_marker = Some(ancestor);
69 top_marker = Some(ancestor);
70 }
70 }
71
71
72− if ancestor.join(".git").is_dir() {
72+ if ancestor.join(".git").exists() {
73 // Top marker is repo root if not root marker was detected yet
73 // Top marker is repo root if not root marker was detected yet
74 if top_marker.is_none() {
74 if top_marker.is_none() {
75 top_marker = Some(ancestor);
75 top_marker = Some(ancestor);
helix-loader/src/grammar.rs+1−1
@@ -263,7 +263,7 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<FetchStatus> {
263 ))?;
263 ))?;
264
264
265 // create the grammar dir contains a git directory
265 // create the grammar dir contains a git directory
266− if !grammar_dir.join(".git").is_dir() {
266+ if !grammar_dir.join(".git").exists() {
267 git(&grammar_dir, ["init"])?;
267 git(&grammar_dir, ["init"])?;
268 }
268 }
269
269
helix-loader/src/lib.rs+1−1
@@ -97,7 +97,7 @@ pub fn find_local_config_dirs() -> Vec<PathBuf> {
97 let mut directories = Vec::new();
97 let mut directories = Vec::new();
98
98
99 for ancestor in current_dir.ancestors() {
99 for ancestor in current_dir.ancestors() {
100− if ancestor.join(".git").is_dir() {
100+ if ancestor.join(".git").exists() {
101 directories.push(ancestor.to_path_buf());
101 directories.push(ancestor.to_path_buf());
102 // Don't go higher than repo if we're in one
102 // Don't go higher than repo if we're in one
103 break;
103 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
207
207
208 // Cap the number of files if we aren't in a git project, preventing
208 // Cap the number of files if we aren't in a git project, preventing
209 // hangs when using the picker in your home directory
209 // 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() {
211 files.collect()
211 files.collect()
212 } else {
212 } else {
213 // const MAX: usize = 8192;
213 // const MAX: usize = 8192;