Skip to content

Commit 2856434

Browse files
authored
Merge pull request #1407 from jsimonrichard/06-19-add_rela_path_to_Item
Add rela_path utility to gix::status::index_worktree::iter::Item
2 parents 34eb0c9 + 1dc4568 commit 2856434

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gix/src/status/index_worktree.rs

+9
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ pub mod iter {
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 {

0 commit comments

Comments
 (0)