pub enum Entry<'index, ContentChange, SubmoduleStatus> {
    Modification {
        entries: &'index [Entry],
        entry: &'index Entry,
        entry_index: usize,
        rela_path: &'index BStr,
        status: EntryStatus<ContentChange, SubmoduleStatus>,
    },
    DirectoryContents {
        entry: Entry,
        collapsed_directory_status: Option<Status>,
    },
    Rewrite {
        source: RewriteSource<'index, ContentChange, SubmoduleStatus>,
        dirwalk_entry: Entry,
        dirwalk_entry_collapsed_directory_status: Option<Status>,
        dirwalk_entry_id: ObjectId,
        diff: Option<DiffLineStats>,
        copy: bool,
    },
}
Available on crate feature worktree-rewrites only.
Expand description

An ‘entry’ in the sense of a merge of modified tracked files and results from a directory walk.

Variants§

§

Modification

A tracked file was modified, and index-specific information is passed.

Fields

§entries: &'index [Entry]

All entries in the index.

§entry: &'index Entry

The entry with modifications.

§entry_index: usize

The index of the entry for lookup in entries - useful to look at neighbors.

§rela_path: &'index BStr

The repository-relative path of the entry.

§status: EntryStatus<ContentChange, SubmoduleStatus>

The computed status of the entry.

§

DirectoryContents

An entry returned by the directory walk, without any relation to the index.

This can happen if ignored files are returned as well, or if rename-tracking is disabled.

Fields

§entry: Entry

The entry found during the disk traversal.

§collapsed_directory_status: Option<Status>

collapsed_directory_status is Some(dir_status) if this entry was part of a directory with the given dir_status that wasn’t the same as the one of entry and if gix_dir::walk::Options::emit_collapsed was CollapsedEntriesEmissionMode::OnStatusMismatch. It will also be Some(dir_status) if that option was CollapsedEntriesEmissionMode::All.

§

Rewrite

The rewrite tracking discovered a match between a deleted and added file, and considers them equal enough, depending on the tracker settings.

Note that the source of the rewrite is always the index as it detects the absence of entries, something that can’t be done during a directory walk.

Fields

§source: RewriteSource<'index, ContentChange, SubmoduleStatus>

The source of the rewrite operation.

§dirwalk_entry: Entry

The untracked entry found during the disk traversal, the destination of the rewrite.

Note that its rela_path is the destination of the rewrite, and the current location of the entry.

§dirwalk_entry_collapsed_directory_status: Option<Status>

collapsed_directory_status is Some(dir_status) if this dirwalk_entry was part of a directory with the given dir_status that wasn’t the same as the one of dirwalk_entry and if gix_dir::walk::Options::emit_collapsed was CollapsedEntriesEmissionMode::OnStatusMismatch. It will also be Some(dir_status) if that option was CollapsedEntriesEmissionMode::All.

§dirwalk_entry_id: ObjectId

The object id after the rename, specifically hashed in order to determine equality.

§diff: Option<DiffLineStats>

It’s None if the ‘source.id’ is equal to dirwalk_entry_id, as identity made an actual diff computation unnecessary. Otherwise, and if enabled, it’s Some(stats) to indicate how similar both entries were.

§copy: bool

If true, this rewrite is created by copy, and ‘source.id’ is pointing to its source. Otherwise, it’s a rename, and ‘source.id’ points to a deleted object, as renames are tracked as deletions and additions of the same or similar content.

Implementations§

source§

impl<ContentChange, SubmoduleStatus> Entry<'_, ContentChange, SubmoduleStatus>

Access

source

pub fn summary(&self) -> Option<Summary>

Return a summary of the entry as digest of its status, or None if this entry is created from the directory walk and is not untracked, or if it is merely to communicate a needed update to the index entry.

source

pub fn source_rela_path(&self) -> &BStr

The repository-relative path at which the source of a rewrite is located.

If this isn’t a rewrite, the path is the location of the entry itself.

source

pub fn destination_rela_path(&self) -> &BStr

The repository-relative path at which the destination of a rewrite is located.

If this isn’t a rewrite, the path is the location of the entry itself.

Trait Implementations§

source§

impl<'index, ContentChange: Clone, SubmoduleStatus: Clone> Clone for Entry<'index, ContentChange, SubmoduleStatus>

source§

fn clone(&self) -> Entry<'index, ContentChange, SubmoduleStatus>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'index, ContentChange: Debug, SubmoduleStatus: Debug> Debug for Entry<'index, ContentChange, SubmoduleStatus>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'index, ContentChange: PartialEq, SubmoduleStatus: PartialEq> PartialEq for Entry<'index, ContentChange, SubmoduleStatus>

source§

fn eq(&self, other: &Entry<'index, ContentChange, SubmoduleStatus>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'index, ContentChange, SubmoduleStatus> StructuralPartialEq for Entry<'index, ContentChange, SubmoduleStatus>

Auto Trait Implementations§

§

impl<'index, ContentChange, SubmoduleStatus> Freeze for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: Freeze, ContentChange: Freeze,

§

impl<'index, ContentChange, SubmoduleStatus> RefUnwindSafe for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: RefUnwindSafe, ContentChange: RefUnwindSafe,

§

impl<'index, ContentChange, SubmoduleStatus> Send for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: Send, ContentChange: Send,

§

impl<'index, ContentChange, SubmoduleStatus> Sync for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: Sync, ContentChange: Sync,

§

impl<'index, ContentChange, SubmoduleStatus> Unpin for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: Unpin, ContentChange: Unpin,

§

impl<'index, ContentChange, SubmoduleStatus> UnwindSafe for Entry<'index, ContentChange, SubmoduleStatus>
where SubmoduleStatus: UnwindSafe, ContentChange: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.