Skip to main content

RepositoryOptions

Struct RepositoryOptions 

Source
#[non_exhaustive]
pub struct RepositoryOptions {
Show 13 fields pub environment: Environment, pub command_runner: Arc<dyn CommandRunner>, pub change_id_generator: Arc<dyn ChangeIdGenerator>, pub diagnostics: DiagnosticsHandle, pub network_trace: bool, pub test_assume_different_owner: bool, pub reference_unix_time: Option<i64>, pub thread_policy: ThreadPolicy, pub work_tree: Option<PathBuf>, pub validate_repository_format: bool, pub open_for_serving: bool, pub promisor_fetcher: Option<Arc<dyn PromisorFetcher>>, pub hook_stdio: HookStdio,
}
Expand description

Options passed to repository open/discover with an explicit Environment.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§environment: Environment

Discovery and configuration environment.

§command_runner: Arc<dyn CommandRunner>

Subprocess runner for hooks, filters, and helpers.

§change_id_generator: Arc<dyn ChangeIdGenerator>

Random bytes for new change ids (grit.changeIds).

§diagnostics: DiagnosticsHandle

Where non-fatal warnings and trace events are delivered.

§network_trace: bool

When true, network operations may emit crate::diagnostics::Trace::Network events.

§test_assume_different_owner: bool

When true, treat repository ownership as a different user (safe.directory tests).

§reference_unix_time: Option<i64>

Wall-clock reference for rev-parse date selectors; embedders set explicitly.

§thread_policy: ThreadPolicy

Parallel worker overrides (--threads in the CLI).

§work_tree: Option<PathBuf>

Work tree path for crate::repo::Repository::open (non-bare repos).

§validate_repository_format: bool

When false, skip crate::repo::validate_repo_format during open.

§open_for_serving: bool

When true, crate::repo::Repository::open resolves path like wire-protocol serving.

§promisor_fetcher: Option<Arc<dyn PromisorFetcher>>

Optional on-demand fetcher for partial-clone promisor objects.

§hook_stdio: HookStdio

Where hook subprocesses write their output (captured by default).

Implementations§

Source§

impl RepositoryOptions

Source

pub fn empty() -> Self

Shorthand for Environment::empty.

Source

pub fn with_environment(environment: Environment) -> Self

Build options around an explicit Environment snapshot.

Source

pub fn with_command_runner(self, runner: Arc<dyn CommandRunner>) -> Self

Override the injectable subprocess runner used for hooks and filters.

Source

pub fn with_change_id_generator( self, generator: Arc<dyn ChangeIdGenerator>, ) -> Self

Override the generator used for random change ids on new commits.

Source

pub fn with_work_tree(self, work_tree: impl Into<PathBuf>) -> Self

Attach an explicit work tree for crate::repo::Repository::open.

Source

pub fn without_format_validation(self) -> Self

Skip repository format validation when opening (discovery follow-up paths).

Source

pub fn for_serving(self) -> Self

Resolve path for smart-HTTP / upload-pack serving instead of a bare git directory.

Source

pub fn with_diagnostics(self, diagnostics: DiagnosticsHandle) -> Self

Override the diagnostic sink for warnings and trace events.

Source

pub fn with_hook_stdio(self, hook_stdio: HookStdio) -> Self

Choose whether hooks run by repositories opened with these options have their output captured (HookStdio::Capture, the default) or write straight to this process’s stderr.

Source

pub fn with_network_trace(self, network_trace: bool) -> Self

Enable or disable network trace events.

Source

pub fn with_promisor_fetcher( self, fetcher: Option<Arc<dyn PromisorFetcher>>, ) -> Self

Install a promisor on-demand object fetcher for repositories opened with these options.

Trait Implementations§

Source§

impl Clone for RepositoryOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RepositoryOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RepositoryOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.