pub struct WorktreeRoot { /* private fields */ }Expand description
Entry point for listing git worktrees rooted at a repository.
Construct with Self::for_repo pointing at any path inside the
repo (typically the repo root); git resolves the actual .git
from there.
Implementations§
Source§impl WorktreeRoot
impl WorktreeRoot
Sourcepub fn for_repo(path: impl Into<PathBuf>) -> Self
pub fn for_repo(path: impl Into<PathBuf>) -> Self
Address worktrees for the repository containing path.
path can be any directory inside the repo; git’s -C
handling resolves the .git itself. Doesn’t validate that
path is in fact a git repo until you call Self::list.
Sourcepub fn list(&self) -> Result<Vec<Worktree>>
pub fn list(&self) -> Result<Vec<Worktree>>
List every worktree git knows about for this repository.
Spawns git -C <repo_path> worktree list --porcelain and
parses the output. The first entry is the main worktree.
Errors if git isn’t on PATH, the path isn’t a git repo, or
the porcelain output is malformed.
Trait Implementations§
Source§impl Clone for WorktreeRoot
impl Clone for WorktreeRoot
Source§fn clone(&self) -> WorktreeRoot
fn clone(&self) -> WorktreeRoot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorktreeRoot
impl RefUnwindSafe for WorktreeRoot
impl Send for WorktreeRoot
impl Sync for WorktreeRoot
impl Unpin for WorktreeRoot
impl UnsafeUnpin for WorktreeRoot
impl UnwindSafe for WorktreeRoot
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