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>,
pub branch_explicit: bool,
}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 strThe remote name to configure and track (--origin, default origin).
checkout_branch: &'a strThe branch to create locally and check out (the requested --branch or
the remote’s default branch).
remote_head_branch: &'a strThe remote’s default branch, used to decide whether to point
refs/remotes/<origin>/HEAD at it.
single_branch: boolWhether 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.
branch_explicit: boolWhether checkout_branch came from an explicit --branch. When set, a
missing remote tip for that branch is a hard error (“Remote branch … not
found”); when unset, a missing tip is an empty/unborn-repository clone.