pub struct Worktree {
pub path: PathBuf,
pub head: Option<String>,
pub branch: Option<String>,
pub is_main: bool,
pub is_detached: bool,
pub is_bare: bool,
pub is_locked: bool,
pub lock_reason: Option<String>,
pub is_prunable: bool,
pub prune_reason: Option<String>,
}Expand description
One git worktree as reported by git worktree list --porcelain.
Fields§
§path: PathBufAbsolute path to the worktree directory.
head: Option<String>Commit SHA at HEAD. None for bare worktrees.
branch: Option<String>Branch name without refs/heads/ prefix. None when the
worktree has detached HEAD (or is bare).
is_main: boolTrue for the primary worktree (the one git considers the
“main” worktree). Always the first in the list returned by
WorktreeRoot::list.
is_detached: boolTrue if HEAD is detached (no branch checked out).
is_bare: boolTrue for a bare repository worktree.
is_locked: boolTrue if git worktree lock has been applied.
lock_reason: Option<String>Optional human-readable lock reason if is_locked.
is_prunable: boolTrue if git considers this worktree prunable (the directory is missing or the lock file is stale).
prune_reason: Option<String>Optional human-readable prunable reason if is_prunable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Worktree
impl RefUnwindSafe for Worktree
impl Send for Worktree
impl Sync for Worktree
impl Unpin for Worktree
impl UnsafeUnpin for Worktree
impl UnwindSafe for Worktree
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