pub struct WorktreeManager { /* private fields */ }Expand description
Manages git worktrees for polecat sessions.
Each polecat session runs in an isolated git worktree to enable parallel work without conflicts. The manager handles creation, tracking, and cleanup of these worktrees.
Implementations§
Source§impl WorktreeManager
impl WorktreeManager
Sourcepub fn new(
repo_root: impl Into<PathBuf>,
worktree_root: impl AsRef<str>,
max_polecats: u32,
) -> Self
pub fn new( repo_root: impl Into<PathBuf>, worktree_root: impl AsRef<str>, max_polecats: u32, ) -> Self
Create a new WorktreeManager.
§Arguments
repo_root- Path to the repository root.worktree_root- Relative path for worktrees (e.g.,.grite/worktrees).max_polecats- Maximum number of concurrent polecat worktrees.
Sourcepub fn worktree_root(&self) -> &Path
pub fn worktree_root(&self) -> &Path
Get the worktree root path.
Sourcepub fn list(&self) -> Result<Vec<WorktreeInfo>, WorktreeError>
pub fn list(&self) -> Result<Vec<WorktreeInfo>, WorktreeError>
List all managed worktrees.
Returns worktrees in the worktree_root directory, excluding the main worktree.
Sourcepub fn get(&self, session_id: &str) -> Result<WorktreeInfo, WorktreeError>
pub fn get(&self, session_id: &str) -> Result<WorktreeInfo, WorktreeError>
Get a worktree by session ID.
Sourcepub fn remove(&self, session_id: &str) -> Result<(), WorktreeError>
pub fn remove(&self, session_id: &str) -> Result<(), WorktreeError>
Remove a worktree by session ID.
Uses --force to remove even if the worktree has uncommitted changes.
Sourcepub fn prune(&self) -> Result<(), WorktreeError>
pub fn prune(&self) -> Result<(), WorktreeError>
Prune stale worktree administrative files.
Sourcepub fn cleanup_stale(
&self,
active_session_ids: &HashSet<String>,
) -> Result<CleanupReport, WorktreeError>
pub fn cleanup_stale( &self, active_session_ids: &HashSet<String>, ) -> Result<CleanupReport, WorktreeError>
Auto Trait Implementations§
impl Forget for WorktreeManager
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