pub struct WorktreeInfo {
pub path: PathBuf,
pub head: String,
pub branch: Option<String>,
pub bare: bool,
pub detached: bool,
pub locked: Option<String>,
pub prunable: Option<String>,
}Expand description
Parsed worktree data from git worktree list --porcelain.
This is a data record containing metadata about a worktree.
For running commands in a worktree, use WorkingTree via
Repository::worktree_at() or BranchRef::working_tree().
Fields§
§path: PathBuf§head: String§branch: Option<String>§bare: bool§detached: bool§locked: Option<String>§prunable: Option<String>Implementations§
Source§impl WorktreeInfo
impl WorktreeInfo
Sourcepub fn is_prunable(&self) -> bool
pub fn is_prunable(&self) -> bool
Returns true if this worktree is prunable (directory deleted but git still tracks metadata).
Prunable worktrees cannot be operated on - the directory doesn’t exist. Most iteration over worktrees should skip prunable ones.
Sourcepub fn has_commits(&self) -> bool
pub fn has_commits(&self) -> bool
Returns true if this worktree points to a real commit (not the null OID).
Unborn branches (no commits yet) have the null OID as their HEAD.
Sourcepub fn dir_name(&self) -> &str
pub fn dir_name(&self) -> &str
Returns the worktree directory name.
This is the filesystem directory name (e.g., “repo.feature” from “/path/to/repo.feature”).
For user-facing display with context (branch consistency, detached state),
use worktree_display_name() from the commands module instead.
Trait Implementations§
Source§impl Clone for WorktreeInfo
impl Clone for WorktreeInfo
Source§fn clone(&self) -> WorktreeInfo
fn clone(&self) -> WorktreeInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorktreeInfo
impl Debug for WorktreeInfo
Source§impl From<&WorktreeInfo> for BranchRef
impl From<&WorktreeInfo> for BranchRef
Source§fn from(wt: &WorktreeInfo) -> Self
fn from(wt: &WorktreeInfo) -> Self
Source§impl PartialEq for WorktreeInfo
impl PartialEq for WorktreeInfo
Source§impl Serialize for WorktreeInfo
impl Serialize for WorktreeInfo
impl StructuralPartialEq for WorktreeInfo
Auto Trait Implementations§
impl Freeze for WorktreeInfo
impl RefUnwindSafe for WorktreeInfo
impl Send for WorktreeInfo
impl Sync for WorktreeInfo
impl Unpin for WorktreeInfo
impl UnsafeUnpin for WorktreeInfo
impl UnwindSafe for WorktreeInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more