pub struct WorktreeManager { /* private fields */ }Expand description
Manages git worktrees for pool slots.
Implementations§
Source§impl WorktreeManager
impl WorktreeManager
Sourcepub fn new(repo_dir: impl Into<PathBuf>, base_dir: Option<PathBuf>) -> Self
pub fn new(repo_dir: impl Into<PathBuf>, base_dir: Option<PathBuf>) -> Self
Create a new worktree manager.
repo_dir: The source repository to create worktrees from.base_dir: Directory where worktrees will be created. IfNone, uses a temp directory under the system temp dir.
Sourcepub async fn create(&self, slot_id: &SlotId) -> Result<PathBuf>
pub async fn create(&self, slot_id: &SlotId) -> Result<PathBuf>
Create a worktree for a slot.
Creates a git worktree at {base_dir}/{slot_id} branched from
the current HEAD.
Sourcepub async fn remove(&self, slot_id: &SlotId) -> Result<()>
pub async fn remove(&self, slot_id: &SlotId) -> Result<()>
Remove a slot’s worktree and its branch.
Sourcepub async fn cleanup_all(&self, slot_ids: &[SlotId]) -> Result<()>
pub async fn cleanup_all(&self, slot_ids: &[SlotId]) -> Result<()>
Remove all worktrees managed by this pool.
Sourcepub fn worktree_path(&self, slot_id: &SlotId) -> PathBuf
pub fn worktree_path(&self, slot_id: &SlotId) -> PathBuf
Get the worktree path for a slot (may not exist yet).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorktreeManager
impl RefUnwindSafe for WorktreeManager
impl Send for WorktreeManager
impl Sync for WorktreeManager
impl Unpin for WorktreeManager
impl UnsafeUnpin for WorktreeManager
impl UnwindSafe for WorktreeManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more