pub struct RepositoryInitOptions { /* private fields */ }
Expand description

Options which can be used to configure how a repository is initialized

Implementations§

source§

impl RepositoryInitOptions

source

pub fn new() -> RepositoryInitOptions

Creates a default set of initialization options.

By default this will set flags for creating all necessary directories and initializing a directory from the user-configured templates path.

source

pub fn bare(&mut self, bare: bool) -> &mut RepositoryInitOptions

Create a bare repository with no working directory.

Defaults to false.

source

pub fn no_reinit(&mut self, enabled: bool) -> &mut RepositoryInitOptions

Return an error if the repository path appears to already be a git repository.

Defaults to false.

source

pub fn no_dotgit_dir(&mut self, enabled: bool) -> &mut RepositoryInitOptions

Normally a ‘/.git/’ will be appended to the repo path for non-bare repos (if it is not already there), but passing this flag prevents that behavior.

Defaults to false.

source

pub fn mkdir(&mut self, enabled: bool) -> &mut RepositoryInitOptions

Make the repo path (and workdir path) as needed. The “.git” directory will always be created regardless of this flag.

Defaults to true.

source

pub fn mkpath(&mut self, enabled: bool) -> &mut RepositoryInitOptions

Recursively make all components of the repo and workdir path as necessary.

Defaults to true.

source

pub fn mode(&mut self, mode: RepositoryInitMode) -> &mut RepositoryInitOptions

Set to one of the RepositoryInit constants, or a custom value.

source

pub fn external_template(&mut self, enabled: bool) -> &mut RepositoryInitOptions

Enable or disable using external templates.

If enabled, then the template_path option will be queried first, then init.templatedir from the global config, and finally /usr/share/git-core-templates will be used (if it exists).

Defaults to true.

source

pub fn workdir_path(&mut self, path: &Path) -> &mut RepositoryInitOptions

The path to the working directory.

If this is a relative path it will be evaluated relative to the repo path. If this is not the “natural” working directory, a .git gitlink file will be created here linking to the repo path.

source

pub fn description(&mut self, desc: &str) -> &mut RepositoryInitOptions

If set, this will be used to initialize the “description” file in the repository instead of using the template content.

source

pub fn template_path(&mut self, path: &Path) -> &mut RepositoryInitOptions

When the external_template option is set, this is the first location to check for the template directory.

If this is not configured, then the default locations will be searched instead.

source

pub fn initial_head(&mut self, head: &str) -> &mut RepositoryInitOptions

The name of the head to point HEAD at.

If not configured, this will be taken from your git configuration. If this begins with refs/ it will be used verbatim; otherwise refs/heads/ will be prefixed

source

pub fn origin_url(&mut self, url: &str) -> &mut RepositoryInitOptions

If set, then after the rest of the repository initialization is completed an origin remote will be added pointing to this URL.

source

pub unsafe fn raw(&self) -> git_repository_init_options

Creates a set of raw init options to be used with git_repository_init_ext.

This method is unsafe as the returned value may have pointers to the interior of this structure.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.