pub struct WorktreeAdd { /* private fields */ }Expand description
Add a new worktree.
§Examples
use ironflow_ops_git::worktree::WorktreeAdd;
use ironflow_core::operation::Operation;
let op = WorktreeAdd::new("/path/to/repo", "wt-feature", "/path/to/worktree");
assert_eq!(op.kind(), "git");Implementations§
Source§impl WorktreeAdd
impl WorktreeAdd
Sourcepub fn new(
repo_path: impl Into<PathBuf>,
name: impl Into<String>,
path: impl Into<PathBuf>,
) -> Self
pub fn new( repo_path: impl Into<PathBuf>, name: impl Into<String>, path: impl Into<PathBuf>, ) -> Self
Create a new worktree-add operation.
The worktree is checked out on a new branch named name, created from
the repository HEAD, unless WorktreeAdd::detached_at is set.
Sourcepub fn detached_at(self, commit: impl Into<String>) -> Self
pub fn detached_at(self, commit: impl Into<String>) -> Self
Check the worktree out with a detached HEAD at commit (a SHA or
any revspec), without creating a branch.
§Examples
use ironflow_ops_git::worktree::WorktreeAdd;
let op = WorktreeAdd::new("/srv/repo.git", "mr-42", "/tmp/mr-42")
.detached_at("5f1c0e2a9b7d4c3e8f6a1b2c3d4e5f60718293a4");Sourcepub async fn run(
&self,
_ctx: &OperationContext,
) -> Result<WorktreeAddOutput, OperationError>
pub async fn run( &self, _ctx: &OperationContext, ) -> Result<WorktreeAddOutput, OperationError>
Execute and return a typed result.
§Errors
Returns OperationError::External if the repository cannot be
opened, the commit does not resolve, or the worktree cannot be added.
Trait Implementations§
Source§impl Operation for WorktreeAdd
impl Operation for WorktreeAdd
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the operation and return the result as JSON. Read more
Source§impl TypedOperation for WorktreeAdd
impl TypedOperation for WorktreeAdd
Source§type Output = WorktreeAddOutput
type Output = WorktreeAddOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl Freeze for WorktreeAdd
impl RefUnwindSafe for WorktreeAdd
impl Send for WorktreeAdd
impl Sync for WorktreeAdd
impl Unpin for WorktreeAdd
impl UnsafeUnpin for WorktreeAdd
impl UnwindSafe for WorktreeAdd
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