#[non_exhaustive]pub struct WorktreeAdd {
pub path: PathBuf,
pub new_branch: Option<String>,
pub commitish: Option<String>,
pub no_checkout: bool,
}Expand description
Options for GitApi::worktree_add (git worktree add).
#[non_exhaustive], so build it through WorktreeAdd::checkout /
WorktreeAdd::create_branch rather than a struct literal.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: PathBufFilesystem path for the new worktree.
new_branch: Option<String>Create and check out this new branch (-b <name>); None checks out an
existing ref.
commitish: Option<String>The commit/branch to base the worktree on; None defaults to HEAD.
no_checkout: boolRegister the worktree without populating its files (--no-checkout) — the
caller fills the working tree itself (e.g. a copy-on-write clone).
Implementations§
Source§impl WorktreeAdd
impl WorktreeAdd
Sourcepub fn checkout(path: impl Into<PathBuf>, commitish: impl Into<String>) -> Self
pub fn checkout(path: impl Into<PathBuf>, commitish: impl Into<String>) -> Self
A worktree at path checking out an existing commitish (e.g. a branch):
git worktree add <path> <commitish>.
Sourcepub fn create_branch(
path: impl Into<PathBuf>,
name: impl Into<String>,
commitish: impl Into<String>,
) -> Self
pub fn create_branch( path: impl Into<PathBuf>, name: impl Into<String>, commitish: impl Into<String>, ) -> Self
A worktree at path creating a new branch name based on commitish:
git worktree add -b <name> <path> <commitish>.
Sourcepub fn no_checkout(self) -> Self
pub fn no_checkout(self) -> Self
Register the worktree without checking out its files (--no-checkout),
for a caller that populates the working tree itself.
Trait Implementations§
Source§impl Clone for WorktreeAdd
impl Clone for WorktreeAdd
Source§fn clone(&self) -> WorktreeAdd
fn clone(&self) -> WorktreeAdd
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more