pub struct Index {
pub entries: Vec<IndexEntry>,
}Expand description
In-memory staging index.
Fields§
§entries: Vec<IndexEntry>Entries in insertion order.
Implementations§
Source§impl Index
impl Index
Sourcepub fn find_entry(&self, path: &str) -> Option<usize>
pub fn find_entry(&self, path: &str) -> Option<usize>
Find an entry by path. O(n).
Sourcepub fn tracks_path_or_descendant(&self, path: &str) -> bool
pub fn tracks_path_or_descendant(&self, path: &str) -> bool
true if path is itself tracked (a non-removed entry) or is an
ancestor directory of a tracked path. Used to decide whether an
ignored worktree path must still be visited because it (or its
subtree) holds tracked content. O(n).
Sourcepub fn has_tracked_file_at(&self, path: &str) -> bool
pub fn has_tracked_file_at(&self, path: &str) -> bool
true if a tracked (non-removed) entry exists at exactly path.
Because the index stores only leaf paths (files / symlinks / exec
files, never directories), a hit means path is tracked as a
non-directory object. Used by the untracked-discovery walks to detect
a worktree directory that shadows a tracked file: git suppresses the
directory’s contents as untracked in that case (#288), reporting only
the tracked-side deletion. A Removed tombstone does not count —
the path is no longer tracked, so its replacement is genuinely
untracked. O(n).
Sourcepub fn staged_count(&self) -> usize
pub fn staged_count(&self) -> usize
Count non-removed entries.
Trait Implementations§
impl Eq for Index
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more