Skip to content

Commit

Permalink
Make it easier to discover is_path_excluded() in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 3, 2024
1 parent a5168aa commit c136329
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions gix-worktree/src/stack/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl<'a> Platform<'a> {
/// # Panics
///
/// If the cache was configured without exclude patterns.
#[doc(alias = "is_path_ignored", alias = "git2")]
pub fn is_excluded(&self) -> bool {
self.matching_exclude_pattern()
.map_or(false, |m| !m.pattern.is_negative())
Expand Down
1 change: 1 addition & 0 deletions gix/src/attribute_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl<'repo> AttributeStack<'repo> {
/// path is created as directory. If it's not known it is assumed to be a file.
///
/// Provide access to cached information for that `relative` path via the returned platform.
#[doc(alias = "is_path_ignored", alias = "git2")]
pub fn at_path(
&mut self,
relative: impl AsRef<std::path::Path>,
Expand Down
1 change: 1 addition & 0 deletions gix/src/repository/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl Repository {
/// When only excludes are desired, this is the most efficient way to obtain them. Otherwise use
/// [`Repository::attributes()`] for accessing both attributes and excludes.
// TODO: test
#[doc(alias = "is_path_ignored", alias = "git2")]
#[cfg(feature = "excludes")]
pub fn excludes(
&self,
Expand Down
5 changes: 5 additions & 0 deletions gix/src/repository/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ impl crate::Repository {
/// Return a shared worktree index which is updated automatically if the in-memory snapshot has become stale as the underlying file
/// on disk has changed.
///
/// ### Notes
///
/// * This will fail if the file doesn't exist, like in a newly initialized repository. If that is the case, use
/// [index_or_empty()](Self::index_or_empty) or [try_index()](Self::try_index) instead.
///
/// The index file is shared across all clones of this repository.
pub fn index(&self) -> Result<worktree::Index, worktree::open_index::Error> {
self.try_index().and_then(|opt| match opt {
Expand Down

0 comments on commit c136329

Please sign in to comment.