History

Add rela_path to crate::status::index_worktree::iter::Item

J. Simon Richard committed 2 years ago

Commit 1dc45681 parent a10a5fb1 file · +9 −0Browse files

Unified · Split

gix/src/status/index_worktree.rs+9−0
@@ -539,6 +539,15 @@ pub mod iter { · 538 unmodified lines
539539 }
540540 })
541541 }
542+
543+ /// The repository-relative path of the entry contained in this item.
544+ pub fn rela_path(&self) -> &BStr {
545+ match self {
546+ Item::Modification { rela_path, .. } => rela_path.as_ref(),
547+ Item::DirectoryContents { entry, .. } => entry.rela_path.as_ref(),
548+ Item::Rewrite { dirwalk_entry, .. } => dirwalk_entry.rela_path.as_ref(),
549+ }
550+ }
542551 }
543552
544553 impl<'index> From<gix_status::index_as_worktree_with_renames::Entry<'index, (), SubmoduleStatus>> for Item {