Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep cli: Clean leftover git locks (#46255)
Agus Zubiaga523c27ab1f0b
diff --git a/crates/edit_prediction_cli/src/load_project.rs b/crates/edit_prediction_cli/src/load_project.rsindex a3dc44a1281..8fa53618f15 100644--- a/crates/edit_prediction_cli/src/load_project.rs+++ b/crates/edit_prediction_cli/src/load_project.rs@@ -204,6 +204,17 @@ async fn setup_worktree(example: &Example, step_progress: &StepProgress) -> Resulet worktree_path = repo_name.worktree_path();let repo_lock = git::lock_repo(&repo_dir).await;+ // Clean up any stale git lock files from previous crashed runs.+ // Safe-ish since we have our own lock.+ // WARNING: Can corrupt worktrees if multiple processes of the CLI are running.+ let worktree_git_dir = repo_dir+ .join(".git/worktrees")+ .join(repo_name.name.as_ref());+ let index_lock = worktree_git_dir.join("index.lock");+ if index_lock.exists() {+ fs::remove_file(&index_lock).ok();+ }+if !repo_dir.is_dir() {step_progress.set_substatus(format!("cloning {}", repo_name.name));fs::create_dir_all(&repo_dir)?;