Skip to main content

CloneOptions

Struct CloneOptions 

Source
pub struct CloneOptions<'a> {
    pub origin: &'a str,
    pub checkout_branch: &'a str,
    pub remote_head_branch: &'a str,
    pub single_branch: bool,
    pub depth: Option<u32>,
    pub deepen_since: Option<i64>,
    pub deepen_not: Vec<String>,
    pub committer: Vec<u8>,
    pub detached_head: Option<ObjectId>,
    pub filter: Option<PackObjectFilter>,
}
Expand description

The clone inputs the library needs for the branch-tracking flow, all resolved by the caller. The remaining git clone knobs (bare/mirror, --revision, templates, config overrides, sparse, separate-git-dir, etc.) stay in the CLI: the unsupported ones are gated before clone is called, and the config-writing ones run inside the configure/configure_branch callbacks.

Fields§

§origin: &'a str

The remote name to configure and track (--origin, default origin).

§checkout_branch: &'a str

The branch to create locally and check out (the requested --branch or the remote’s default branch).

§remote_head_branch: &'a str

The remote’s default branch, used to decide whether to point refs/remotes/<origin>/HEAD at it.

§single_branch: bool

Whether only checkout_branch was fetched (--single-branch); when set, refs/remotes/<origin>/HEAD is only written if the checked-out branch is the remote default.

§depth: Option<u32>

Shallow clone depth (--depth N): truncate history to N commits per tip, writing $GIT_DIR/shallow. None is a full clone. Honored by the HTTP and SSH transports and by the in-process local server (git clone --no-local --depth N <path>); a depth on a plain local clone is warned-and-ignored upstream of clone by the caller, matching git’s is_local behavior.

§deepen_since: Option<i64>

--shallow-since=<date> (parsed to an epoch): deepen to commits newer than the date. Local in-process transport only.

§deepen_not: Vec<String>

--shallow-exclude=<ref> values, resolved against the remote.

§committer: Vec<u8>

The committer identity for the branch-creation and checkout reflog entries.

§detached_head: Option<ObjectId>

The remote HEAD is detached at this commit (no default branch). After the fetch the destination checks out this commit detached instead of creating checkout_branch; refs/remotes/<origin>/HEAD is not written.

§filter: Option<PackObjectFilter>

Partial-clone object filter (--filter=blob:none) to apply to the clone fetch. Only honored by the in-process local server.

Auto Trait Implementations§

§

impl<'a> Freeze for CloneOptions<'a>

§

impl<'a> RefUnwindSafe for CloneOptions<'a>

§

impl<'a> Send for CloneOptions<'a>

§

impl<'a> Sync for CloneOptions<'a>

§

impl<'a> Unpin for CloneOptions<'a>

§

impl<'a> UnsafeUnpin for CloneOptions<'a>

§

impl<'a> UnwindSafe for CloneOptions<'a>

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>,

Source§

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>,

Source§

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.