Struct gix_config::file::includes::Options
source · pub struct Options<'a> {
pub max_depth: u8,
pub err_on_max_depth_exceeded: bool,
pub err_on_interpolation_failure: bool,
pub err_on_missing_config_path: bool,
pub interpolate: Context<'a>,
pub conditional: Context<'a>,
}
Expand description
Options to handle includes, like include.path
or includeIf.<condition>.path
,
Fields§
§max_depth: u8
The maximum allowed length of the file include chain built by following nested resolve_includes where base level is depth = 0.
err_on_max_depth_exceeded: bool
When max depth is exceeded while following nested includes, return an error if true or silently stop following resolve_includes.
Setting this value to false allows to read configuration with cycles, which otherwise always results in an error.
err_on_interpolation_failure: bool
If true, default false, failing to interpolate paths will result in an error.
Interpolation also happens if paths in conditional includes can’t be interpolated.
err_on_missing_config_path: bool
If true, default true, configuration not originating from a path will cause errors when trying to resolve relative include paths (which would require the including configuration’s path).
interpolate: Context<'a>
Used during path interpolation, both for include paths before trying to read the file, and for
paths used in conditional gitdir
includes.
conditional: Context<'a>
Additional context for conditional includes to work.
Implementations§
source§impl<'a> Options<'a>
impl<'a> Options<'a>
sourcepub fn follow(interpolate: Context<'a>, conditional: Context<'a>) -> Self
pub fn follow(interpolate: Context<'a>, conditional: Context<'a>) -> Self
Provide options to follow includes like git does, provided the required conditional
and interpolate
contexts
to support gitdir
and onbranch
based includeIf
directives as well as standard include.path
resolution.
Note that the follow-mode is git
-style, following at most 10 indirections while
producing an error if the depth is exceeded.
sourcepub fn strict(self) -> Self
pub fn strict(self) -> Self
For use with follow
type options, cause failure if an include path couldn’t be interpolated or the depth limit is exceeded.
sourcepub fn follow_without_conditional(home_dir: Option<&'a Path>) -> Self
pub fn follow_without_conditional(home_dir: Option<&'a Path>) -> Self
Like follow
, but without information to resolve includeIf
directories as well as default
configuration to allow resolving ~username/
path. home_dir
is required to resolve ~/
paths if set.
Note that %(prefix)
paths cannot be interpolated with this configuration, use follow()
instead for complete control.
sourcepub fn interpolate_with(self, context: Context<'a>) -> Self
pub fn interpolate_with(self, context: Context<'a>) -> Self
Set the context used for interpolation when interpolating paths to include as well as the paths
in gitdir
conditional includes.