Struct git2::Worktree[][src]

pub struct Worktree { /* fields omitted */ }
Expand description

An owned git worktree

This structure corresponds to a git_worktree in libgit2.

Implementations

impl Worktree[src]

pub fn open_from_repository(repo: &Repository) -> Result<Worktree, Error>[src]

Open a worktree of a the repository

If a repository is not the main tree but a worktree, this function will look up the worktree inside the parent repository and create a new git_worktree structure.

pub fn name(&self) -> Option<&str>[src]

Retrieves the name of the worktree

This is the name that can be passed to repo::Repository::find_worktree to reopen the worktree. This is also the name that would appear in the list returned by repo::Repository::worktrees

pub fn path(&self) -> &Path[src]

Retrieves the path to the worktree

This is the path to the top-level of the source and not the path to the .git file within the worktree. This path can be passed to repo::Repository::open.

pub fn validate(&self) -> Result<(), Error>[src]

Validates the worktree

This checks that it still exists on the filesystem and that the metadata is correct

pub fn lock(&self, reason: Option<&str>) -> Result<(), Error>[src]

Locks the worktree

pub fn unlock(&self) -> Result<(), Error>[src]

Unlocks the worktree

pub fn is_locked(&self) -> Result<WorktreeLockStatus, Error>[src]

Checks if worktree is locked

pub fn prune(
    &self,
    opts: Option<&mut WorktreePruneOptions>
) -> Result<(), Error>
[src]

Prunes the worktree

pub fn is_prunable(
    &self,
    opts: Option<&mut WorktreePruneOptions>
) -> Result<bool, Error>
[src]

Checks if the worktree is prunable

Trait Implementations

impl Drop for Worktree[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl RefUnwindSafe for Worktree

impl !Send for Worktree

impl !Sync for Worktree

impl Unpin for Worktree

impl UnwindSafe for Worktree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.