Skip to content

Commit

Permalink
feat: Add From<gix_object::tree::EntryKind> for entry::Mode
Browse files Browse the repository at this point in the history
That way it's easier to add new entries to the index.
  • Loading branch information
Byron committed Feb 13, 2025
1 parent 668cb12 commit de4375a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions gix-index/src/entry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,21 @@ mod access {
mod _impls {
use std::cmp::Ordering;

use crate::{entry, Entry, State};
use bstr::BStr;

use crate::{Entry, State};
use gix_object::tree::EntryKind;

impl From<EntryKind> for entry::Mode {
fn from(value: EntryKind) -> Self {
match value {
EntryKind::Tree => entry::Mode::DIR,
EntryKind::Blob => entry::Mode::FILE,
EntryKind::BlobExecutable => entry::Mode::FILE_EXECUTABLE,
EntryKind::Link => entry::Mode::SYMLINK,
EntryKind::Commit => entry::Mode::COMMIT,
}
}
}

impl Entry {
/// Compare one entry to another by their path, by comparing only their common path portion byte by byte, then resorting to
Expand Down

0 comments on commit de4375a

Please sign in to comment.