Skip to content

Commit

Permalink
feat: add entry::Mode::is_submodule()
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 21, 2023
1 parent 9fe3052 commit 5fd6364
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gix-index/src/entry/mode.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use crate::entry::Mode;

impl Mode {
/// Return true if this is a sparse entry, as it points to a directory which usually isn't what an 'unsparse' index tracks.
/// Return `true` if this is a sparse entry, as it points to a directory which usually isn't what an 'unsparse' index tracks.
pub fn is_sparse(&self) -> bool {
*self == Self::DIR
}

/// Return `true` if this is a submodule entry.
pub fn is_submodule(&self) -> bool {
*self == Self::DIR | Self::SYMLINK
}

/// Compares this mode to the file system version ([`std::fs::symlink_metadata`])
/// and returns the change needed to update this mode to match the file.
///
Expand Down

0 comments on commit 5fd6364

Please sign in to comment.