Skip to content

Commit 39021c1

Browse files
committed
adapt to changes in gix-dir
1 parent e6ed377 commit 39021c1

File tree

2 files changed

+6
-2
lines changed
  • gitoxide-core/src/repository
  • gix-status/src/index_as_worktree_with_renames

2 files changed

+6
-2
lines changed

gitoxide-core/src/repository/clean.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub(crate) mod function {
163163
.join(gix::path::from_bstr(entry.rela_path.as_bstr()))
164164
.metadata()
165165
.ok()
166-
.and_then(|e| gix::dir::entry::Kind::try_from_file_type(e.file_type()));
166+
.map(|e| e.file_type().into());
167167
}
168168
let mut disk_kind = entry.disk_kind.expect("present if not pruned");
169169
if !keep {
@@ -183,6 +183,7 @@ pub(crate) mod function {
183183
}
184184

185185
match disk_kind {
186+
Kind::NonFile => unreachable!("these are always considered pruned, and they were skipped earlier."),
186187
Kind::File | Kind::Symlink => {}
187188
Kind::Directory => {
188189
if !directories {
@@ -254,6 +255,7 @@ pub(crate) mod function {
254255
"WOULD remove"
255256
},
256257
suffix = match disk_kind {
258+
Kind::NonFile => unreachable!("these are always considered pruned, and they were skipped earlier."),
257259
Kind::Directory if entry.property == Some(gix::dir::entry::Property::EmptyDirectory) => {
258260
" empty"
259261
}

gix-status/src/index_as_worktree_with_renames/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ pub(super) mod function {
466466
ModificationOrDirwalkEntry::Modification(c) => c.entry.mode.to_tree_entry_mode(),
467467
ModificationOrDirwalkEntry::DirwalkEntry { entry, .. } => entry.disk_kind.map(|kind| {
468468
match kind {
469+
Kind::NonFile => unreachable!("we rejected non-file entries earlier"),
469470
Kind::File => gix_object::tree::EntryKind::Blob,
470471
Kind::Symlink => gix_object::tree::EntryKind::Link,
471472
Kind::Repository | Kind::Directory => gix_object::tree::EntryKind::Tree,
@@ -495,11 +496,12 @@ pub(super) mod function {
495496
buf: &mut Vec<u8>,
496497
should_interrupt: &std::sync::atomic::AtomicBool,
497498
) -> Result<gix_hash::ObjectId, Error> {
498-
let Some(kind) = disk_kind else {
499+
let Some(kind) = disk_kind.filter(|kind| !matches!(kind, Kind::NonFile)) else {
499500
return Ok(object_hash.null());
500501
};
501502

502503
Ok(match kind {
504+
Kind::NonFile => unreachable!("rejected earlier"),
503505
Kind::File => {
504506
let platform = attrs
505507
.at_entry(rela_path, None, objects)

0 commit comments

Comments
 (0)