Struct git_repository::Worktree
source · pub struct Worktree<'repo> { /* private fields */ }
Expand description
A worktree checkout containing the files of the repository in consumable form.
Implementations§
source§impl<'repo> Worktree<'repo>
impl<'repo> Worktree<'repo>
sourcepub fn open_index(&self) -> Result<File, Error>
pub fn open_index(&self) -> Result<File, Error>
A shortcut to crate::Repository::open_index()
.
source§impl<'repo> Worktree<'repo>
impl<'repo> Worktree<'repo>
Access
sourcepub fn is_main(&self) -> bool
pub fn is_main(&self) -> bool
Return true if this worktree is the main worktree associated with a non-bare git repository.
It cannot be removed.
sourcepub fn is_locked(&self) -> bool
pub fn is_locked(&self) -> bool
Return true if this worktree cannot be pruned, moved or deleted, which is useful if it is located on an external storage device.
Always false for the main worktree.
sourcepub fn lock_reason(&self) -> Option<BString>
pub fn lock_reason(&self) -> Option<BString>
Provide a reason for the locking of this worktree, if it is locked at all.
Note that we squelch errors in case the file cannot be read in which case the reason is an empty string.