pub struct InitCommand {
pub executor: CommandExecutor,
pub directory: Option<PathBuf>,
pub bare: bool,
pub quiet: bool,
pub initial_branch: Option<String>,
pub shared: Option<String>,
pub template: Option<PathBuf>,
pub separate_git_dir: Option<PathBuf>,
}Expand description
Builder for git init.
Fields§
§executor: CommandExecutorShared executor (args, cwd, env, timeout).
directory: Option<PathBuf>Directory to initialize. If None, uses the executor’s cwd.
bare: boolCreate a bare repository (--bare).
quiet: boolSuppress output (-q, --quiet).
initial_branch: Option<String>Initial branch name (--initial-branch).
Shared repository mode (--shared).
template: Option<PathBuf>Template directory (--template).
separate_git_dir: Option<PathBuf>Separate git dir (--separate-git-dir).
Implementations§
Source§impl InitCommand
impl InitCommand
Sourcepub fn in_directory(path: impl Into<PathBuf>) -> Self
pub fn in_directory(path: impl Into<PathBuf>) -> Self
Build an init for the given directory.
Sourcepub fn initial_branch(&mut self, name: impl Into<String>) -> &mut Self
pub fn initial_branch(&mut self, name: impl Into<String>) -> &mut Self
Set the initial branch name (default on modern git: main).
Enable sharing mode (e.g. "group", "all", "0660").
Sourcepub fn separate_git_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self
pub fn separate_git_dir(&mut self, path: impl Into<PathBuf>) -> &mut Self
Store the git dir separately from the working tree.
Trait Implementations§
Source§impl Clone for InitCommand
impl Clone for InitCommand
Source§fn clone(&self) -> InitCommand
fn clone(&self) -> InitCommand
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 moreSource§impl Debug for InitCommand
impl Debug for InitCommand
Source§impl Default for InitCommand
impl Default for InitCommand
Source§fn default() -> InitCommand
fn default() -> InitCommand
Returns the “default value” for a type. Read more
Source§impl GitCommand for InitCommand
impl GitCommand for InitCommand
Source§type Output = Repository
type Output = Repository
The typed output produced by this command.
Source§fn get_executor(&self) -> &CommandExecutor
fn get_executor(&self) -> &CommandExecutor
Borrow the shared executor.
Source§fn get_executor_mut(&mut self) -> &mut CommandExecutor
fn get_executor_mut(&mut self) -> &mut CommandExecutor
Mutably borrow the shared executor.
Source§fn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the full argument vector (subcommand + flags + positionals)
excluding the leading
git program.Source§fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Repository>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Repository>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run the command and decode its output into
Self::Output.Source§fn execute_raw<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute_raw<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Spawn
git with the given arguments and return the raw output. Read moreSource§fn current_dir<P: Into<PathBuf>>(&mut self, dir: P) -> &mut Self
fn current_dir<P: Into<PathBuf>>(&mut self, dir: P) -> &mut Self
Run
git in the given working directory.Source§fn env<K: Into<OsString>, V: Into<OsString>>(
&mut self,
key: K,
value: V,
) -> &mut Self
fn env<K: Into<OsString>, V: Into<OsString>>( &mut self, key: K, value: V, ) -> &mut Self
Set an environment variable for this invocation.
Source§fn with_timeout(&mut self, timeout: Duration) -> &mut Self
fn with_timeout(&mut self, timeout: Duration) -> &mut Self
Cap execution time. On expiry the process is killed and
Error::Timeout is returned.Source§fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self
fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self
Convenience: set timeout in whole seconds.
Auto Trait Implementations§
impl Freeze for InitCommand
impl RefUnwindSafe for InitCommand
impl Send for InitCommand
impl Sync for InitCommand
impl Unpin for InitCommand
impl UnsafeUnpin for InitCommand
impl UnwindSafe for InitCommand
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