diff --git a/simulator/runner/bugbase.rs b/simulator/runner/bugbase.rs index a34847655..89ad25e71 100644 --- a/simulator/runner/bugbase.rs +++ b/simulator/runner/bugbase.rs @@ -470,12 +470,18 @@ impl BugBase { } fn find_git_dir(start_path: impl AsRef) -> Option { - // HACK ignores stuff like bare repo, worktree, etc. let mut current = start_path.as_ref().to_path_buf(); loop { let git_path = current.join(".git"); if git_path.is_dir() { return Some(git_path); + } else if git_path.is_file() { + // Handle git worktrees - .git is a file containing "gitdir: " + if let Ok(contents) = read_to_string(&git_path) { + if let Some(gitdir) = contents.strip_prefix("gitdir: ") { + return Some(PathBuf::from(gitdir)); + } + } } if !current.pop() { return None;