Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly handle detachted git worktrees #5097

Merged
merged 1 commit into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
properly handle detachted git worktrees
  • Loading branch information
pascalkuthe committed Dec 9, 2022
commit 4afb4c78313c676656ab6f12b452049ca47f1280
2 changes: 1 addition & 1 deletion helix-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::Path
top_marker = Some(ancestor);
}

if ancestor.join(".git").is_dir() {
if ancestor.join(".git").exists() {
// Top marker is repo root if not root marker was detected yet
if top_marker.is_none() {
top_marker = Some(ancestor);
Expand Down
2 changes: 1 addition & 1 deletion helix-loader/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<FetchStatus> {
))?;

// create the grammar dir contains a git directory
if !grammar_dir.join(".git").is_dir() {
if !grammar_dir.join(".git").exists() {
git(&grammar_dir, ["init"])?;
}

Expand Down
2 changes: 1 addition & 1 deletion helix-loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn find_local_config_dirs() -> Vec<PathBuf> {
let mut directories = Vec::new();

for ancestor in current_dir.ancestors() {
if ancestor.join(".git").is_dir() {
if ancestor.join(".git").exists() {
directories.push(ancestor.to_path_buf());
// Don't go higher than repo if we're in one
break;
Expand Down
2 changes: 1 addition & 1 deletion helix-term/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi

// Cap the number of files if we aren't in a git project, preventing
// hangs when using the picker in your home directory
let files: Vec<_> = if root.join(".git").is_dir() {
let files: Vec<_> = if root.join(".git").exists() {
files.collect()
} else {
// const MAX: usize = 8192;
Expand Down