pub struct AttributeStack<'repo> {
pub repo: &'repo Repository,
/* private fields */
}excludes or attributes only.Expand description
A utility to access .gitattributes and .gitignore information efficiently.
Fields§
§repo: &'repo RepositoryThe owning repository.
Implementations§
Source§impl<'repo> AttributeStack<'repo>
Lifecycle
impl<'repo> AttributeStack<'repo>
Lifecycle
Sourcepub fn new(stack: Stack, repo: &'repo Repository) -> Self
Available on crate feature excludes only.
pub fn new(stack: Stack, repo: &'repo Repository) -> Self
excludes only.Create a new instance from a repo and the underlying pre-configured stack.
Note that this type is typically created by Repository::attributes() or Repository::attributes_only().
Source§impl AttributeStack<'_>
Platform retrieval
impl AttributeStack<'_>
Platform retrieval
Sourcepub fn at_path(
&mut self,
relative: impl AsRef<Path>,
mode: Option<Mode>,
) -> Result<Platform<'_>>
Available on crate feature excludes only.
pub fn at_path( &mut self, relative: impl AsRef<Path>, mode: Option<Mode>, ) -> Result<Platform<'_>>
excludes only.Append the relative path to the root directory of the cache and load all attribute or ignore files on the way as needed.
Use mode to specify what kind of item lives at relative - directories may match against rules specifically.
If mode is None, the item at relative is assumed to be a file.
The returned platform may be used to access the actual attribute or ignore information.
Sourcepub fn at_entry(
&mut self,
relative: impl ToNormalPathComponents,
mode: Option<Mode>,
) -> Result<Platform<'_>>
Available on crate feature excludes only.
pub fn at_entry( &mut self, relative: impl ToNormalPathComponents, mode: Option<Mode>, ) -> Result<Platform<'_>>
excludes only.Obtain a platform for attribute or ignore lookups from a repo-relative path, typically obtained from an index entry.
mode should reflect whether it’s a directory or not, or left at None if unknown.
If relative ends with / and mode is None, it is automatically assumed to be a directory.
Methods from Deref<Target = Stack>§
Sourcepub fn at_path(
&mut self,
relative: impl ToNormalPathComponents,
mode: Option<Mode>,
objects: &dyn Find,
) -> Result<Platform<'_>, Error>
Available on crate feature excludes only.
pub fn at_path( &mut self, relative: impl ToNormalPathComponents, mode: Option<Mode>, objects: &dyn Find, ) -> Result<Platform<'_>, Error>
excludes only.Append the relative path to the root directory of the cache and efficiently create leading directories, while assuring that no
symlinks are in that path.
Unless mode is known with Some(gix_index::entry::Mode::DIR|COMMIT),
then relative points to a directory itself in which case the entire resulting path is created as directory.
If it’s not known it is assumed to be a file.
objects maybe used to lookup objects from an id mapping, with mappnigs
Provide access to cached information for that relative path via the returned platform.
Sourcepub fn at_entry<'r>(
&mut self,
relative: impl Into<&'r BStr>,
mode: Option<Mode>,
objects: &dyn Find,
) -> Result<Platform<'_>, Error>
Available on crate feature excludes only.
pub fn at_entry<'r>( &mut self, relative: impl Into<&'r BStr>, mode: Option<Mode>, objects: &dyn Find, ) -> Result<Platform<'_>, Error>
excludes only.Obtain a platform for lookups from a repo-relative path, typically obtained from an index entry. mode should reflect
the kind of item set here, or left at None if unknown.
objects maybe used to lookup objects from an id mapping.
All effects are similar to at_path().
If relative ends with / and mode is None, it is automatically assumed set to be a directory.
Sourcepub fn take_statistics(&mut self) -> Statistics
Available on crate feature excludes only.
pub fn take_statistics(&mut self) -> Statistics
excludes only.Reset the statistics after returning them.
Sourcepub fn state_mut(&mut self) -> &mut State
Available on crate feature excludes only.
pub fn state_mut(&mut self) -> &mut State
excludes only.Return our state for applying changes.
Sourcepub fn set_case(&mut self, case: Case) -> &mut Stack
Available on crate feature excludes only.
pub fn set_case(&mut self, case: Case) -> &mut Stack
excludes only.Change the case of the next match to the given one.
Sourcepub fn statistics(&self) -> &Statistics
Available on crate feature excludes only.
pub fn statistics(&self) -> &Statistics
excludes only.Return the statistics we gathered thus far.
Sourcepub fn state(&self) -> &State
Available on crate feature excludes only.
pub fn state(&self) -> &State
excludes only.Return the state for introspection.
Sourcepub fn base(&self) -> &Path
Available on crate feature excludes only.
pub fn base(&self) -> &Path
excludes only.Return the base path against which all entries or paths should be relative to when querying.
Note that this path may not be canonicalized.
Sourcepub fn attribute_matches(&self) -> Outcome
Available on crate feature excludes only.
pub fn attribute_matches(&self) -> Outcome
excludes only.Creates a new container to store match outcomes for all attribute matches.
§Panics
If attributes aren’t configured.
Sourcepub fn selected_attribute_matches<'a>(
&self,
given: impl IntoIterator<Item = impl Into<&'a str>>,
) -> Outcome
Available on crate feature excludes only.
pub fn selected_attribute_matches<'a>( &self, given: impl IntoIterator<Item = impl Into<&'a str>>, ) -> Outcome
excludes only.Creates a new container to store match outcomes for the given attributes.
§Panics
If attributes aren’t configured.
Sourcepub fn attributes_collection(&self) -> &MetadataCollection
Available on crate feature excludes only.
pub fn attributes_collection(&self) -> &MetadataCollection
excludes only.Return the metadata collection that enables initializing attribute match outcomes as done in
attribute_matches() or selected_attribute_matches()
§Panics
If attributes aren’t configured.
Trait Implementations§
Source§impl Deref for AttributeStack<'_>
Available on crate feature excludes only.
impl Deref for AttributeStack<'_>
excludes only.