pub enum Status {
Pruned,
Tracked,
Ignored(Kind),
Untracked,
}
Expand description
The kind of entry as obtained from a directory.
Variants§
Pruned
The entry was removed from the walk due to its other properties, like Property or PathspecMatch
Note that entries flagged as DotGit
directory will always be considered Pruned
, but if they are
also ignored, in delete mode, they will be considered Ignored
instead. This way, it’s easier to remove them
while they will not be available for any interactions in read-only mode.
Tracked
The entry is tracked in Git.
Ignored(Kind)
The entry is ignored as per .gitignore
files and their rules.
If this is a directory, then its entire contents is ignored. Otherwise, possibly due to configuration, individual ignored files are listed.
Untracked
The entry is not tracked by git yet, it was not found in the index.
If it’s a directory, the entire directory contents is untracked.
Implementations§
Source§impl Status
impl Status
Sourcepub fn is_pruned(&self) -> bool
pub fn is_pruned(&self) -> bool
Return true if this status is considered pruned. A pruned entry is typically hidden from view due to a pathspec.
Sourcepub fn can_recurse(
&self,
file_type: Option<Kind>,
pathspec_match: Option<PathspecMatch>,
for_deletion: Option<ForDeletionMode>,
worktree_root_is_repository: bool,
) -> bool
pub fn can_recurse( &self, file_type: Option<Kind>, pathspec_match: Option<PathspecMatch>, for_deletion: Option<ForDeletionMode>, worktree_root_is_repository: bool, ) -> bool
Return true
if file_type
is a directory on disk and isn’t ignored, and is not a repository.
This implements the default rules of git status
, which is good for a minimal traversal through
tracked and non-ignored portions of a worktree.
for_deletion
is used to determine if recursion into a directory is allowed even though it otherwise wouldn’t be.
If worktree_root_is_repository
is true
, then this status is part of the root of an iteration, and the corresponding
worktree root is a repository itself. This typically happens for submodules. In this case, recursion rules are relaxed
to allow traversing submodule worktrees.
Use pathspec_match
to determine if a pathspec matches in any way, affecting the decision to recurse.