#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.environment: EnvironmentDiscovery 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: DiagnosticsHandleWhere non-fatal warnings and trace events are delivered.
network_trace: boolWhen true, network operations may emit crate::diagnostics::Trace::Network events.
test_assume_different_owner: boolWhen 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: ThreadPolicyParallel worker overrides (--threads in the CLI).
work_tree: Option<PathBuf>Work tree path for crate::repo::Repository::open (non-bare repos).
validate_repository_format: boolWhen false, skip crate::repo::validate_repo_format during open.
open_for_serving: boolWhen 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: HookStdioWhere hook subprocesses write their output (captured by default).
Implementations§
Source§impl RepositoryOptions
impl RepositoryOptions
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Options with Environment::empty: no home directory, no global config and, on
Windows, no system config.
Operations then ignore settings such as core.autocrlf, user.name, safe.directory
and core.excludesFile from the user’s system and global config, so results can differ
from git on the same repository. Meant for tests and repositories the caller created;
use Self::from_process for a user’s repositories.
Sourcepub fn from_process() -> Self
pub fn from_process() -> Self
Options with Environment::capture_process: the embedder equivalent of running git
or grit in this process.
System and global config apply (core.autocrlf, identity, safe.directory,
core.excludesFile, credential helpers), found through HOME, GIT_CONFIG_* and, on
Windows, ProgramFiles. Call it at the program boundary, not from library code.
Sourcepub fn with_environment(environment: Environment) -> Self
pub fn with_environment(environment: Environment) -> Self
Options around an explicit Environment snapshot.
This is an associated constructor, not a builder method: write
RepositoryOptions::with_environment(env).with_command_runner(runner).
Sourcepub fn with_command_runner(self, runner: Arc<dyn CommandRunner>) -> Self
pub fn with_command_runner(self, runner: Arc<dyn CommandRunner>) -> Self
Override the injectable subprocess runner used for hooks and filters.
Sourcepub fn with_change_id_generator(
self,
generator: Arc<dyn ChangeIdGenerator>,
) -> Self
pub fn with_change_id_generator( self, generator: Arc<dyn ChangeIdGenerator>, ) -> Self
Override the generator used for random change ids on new commits.
Sourcepub fn with_work_tree(self, work_tree: impl Into<PathBuf>) -> Self
pub fn with_work_tree(self, work_tree: impl Into<PathBuf>) -> Self
Attach an explicit work tree for crate::repo::Repository::open.
Sourcepub fn without_format_validation(self) -> Self
pub fn without_format_validation(self) -> Self
Skip repository format validation when opening (discovery follow-up paths).
Sourcepub fn for_serving(self) -> Self
pub fn for_serving(self) -> Self
Resolve path for smart-HTTP / upload-pack serving instead of a bare git directory.
Sourcepub fn with_diagnostics(self, diagnostics: DiagnosticsHandle) -> Self
pub fn with_diagnostics(self, diagnostics: DiagnosticsHandle) -> Self
Override the diagnostic sink for warnings and trace events.
Sourcepub fn with_hook_stdio(self, hook_stdio: HookStdio) -> Self
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.
Sourcepub fn with_network_trace(self, network_trace: bool) -> Self
pub fn with_network_trace(self, network_trace: bool) -> Self
Enable or disable network trace events.
Sourcepub fn with_promisor_fetcher(
self,
fetcher: Option<Arc<dyn PromisorFetcher>>,
) -> Self
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.