Skip to main content

create_worktree

Function create_worktree 

Source
pub fn create_worktree(repo_root: &Path, sha: &str) -> Result<TempWorktree>
Expand description

Create a temporary detached worktree at sha and return a drop guard.

The directory name includes the current process ID so concurrent hotspots processes analyzing the same SHA use separate paths. Any stale directory left by an interrupted previous run with the same PID is removed before creating the new worktree. The worktree is automatically torn down when the returned TempWorktree is dropped.