pub struct CloneOptions {
pub callback_config: Option<CallbackConfig>,
pub shallow: bool,
pub depth: Option<i32>,
pub branch: Option<String>,
pub refspecs: Vec<String>,
pub trust: CloneTrust,
pub submodule_mode: SubmoduleMode,
pub filter_mode: FilterMode,
pub proxy_url: Option<String>,
pub timeout_seconds: Option<u32>,
}Expand description
Send-safe options for cloning a repository
Fields§
§callback_config: Option<CallbackConfig>Send-safe callback configuration
shallow: boolWhether to perform a shallow clone
depth: Option<i32>Depth for shallow clones
branch: Option<String>Branch to checkout
refspecs: Vec<String>Custom refspecs
trust: CloneTrustTrust posture for this clone. See CloneTrust.
submodule_mode: SubmoduleModeSubmodule handling, subject to the CloneTrust::Untrusted clamp —
see CloneOptions::effective_submodule_mode.
filter_mode: FilterModeContent filter handling, subject to the CloneTrust::Untrusted
clamp — see CloneOptions::effective_filter_mode.
proxy_url: Option<String>Network proxy URL
timeout_seconds: Option<u32>Timeout in seconds for network operations
Implementations§
Source§impl CloneOptions
impl CloneOptions
Sourcepub fn builder() -> CloneOptionsBuilder
pub fn builder() -> CloneOptionsBuilder
Create a new CloneOptions builder
Sourcepub fn with_callback_config(config: CallbackConfig) -> Self
pub fn with_callback_config(config: CallbackConfig) -> Self
Create options with callback configuration
Sourcepub fn effective_submodule_mode(&self) -> SubmoduleMode
pub fn effective_submodule_mode(&self) -> SubmoduleMode
The submodule mode actually in effect, after applying the
CloneTrust::Untrusted clamp. Under Untrusted this is always
SubmoduleMode::Disabled, regardless of self.submodule_mode —
this is the single source of truth callers and tests should read,
rather than the raw field.
Sourcepub fn effective_filter_mode(&self) -> FilterMode
pub fn effective_filter_mode(&self) -> FilterMode
The filter mode actually in effect, after applying the
CloneTrust::Untrusted clamp. Under Untrusted this is always
FilterMode::Passthrough, regardless of self.filter_mode.
Sourcepub fn validate_trust(&self) -> Result<(), Git2DBError>
pub fn validate_trust(&self) -> Result<(), Git2DBError>
Validate that an CloneTrust::Untrusted clone cannot silently widen
its own credential surface — checked independently of the submodule/
filter clamps above, which cannot be bypassed by construction, but
auth is a Vec<AuthStrategy> the caller assembles separately.
Refuses:
AuthMode::AllowAmbient— untrusted fetches must stayAuthMode::ExplicitOnly(credential helper /~/.gitconfig/ SSH agent must never be consulted for an attacker-influenced remote).- An unscoped
crate::auth::AuthStrategy::Token(host: None) — such a token is offered to any remote that challenges for it (seeauth.rs), which for an untrusted, caller-selected remote is a credential-exfiltration vector. Untrusted clones must use either no token or one bound to an exact origin authority.
Trusted options always validate successfully — this check exists
only to keep Untrusted honest.
Trait Implementations§
Source§impl Clone for CloneOptions
impl Clone for CloneOptions
Source§fn clone(&self) -> CloneOptions
fn clone(&self) -> CloneOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for CloneOptions
impl Default for CloneOptions
Source§fn default() -> CloneOptions
fn default() -> CloneOptions
Auto Trait Implementations§
impl Freeze for CloneOptions
impl !RefUnwindSafe for CloneOptions
impl Send for CloneOptions
impl Sync for CloneOptions
impl Unpin for CloneOptions
impl UnsafeUnpin for CloneOptions
impl !UnwindSafe for CloneOptions
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more