diff --git a/gix-diff/src/blob/mod.rs b/gix-diff/src/blob/mod.rs index a5ce1fa7b47..541e978d752 100644 --- a/gix-diff/src/blob/mod.rs +++ b/gix-diff/src/blob/mod.rs @@ -113,7 +113,7 @@ pub struct Platform { pub attr_stack: gix_worktree::Stack, /// The way we convert resources into diffable states. - filter_mode: pipeline::Mode, + pub filter_mode: pipeline::Mode, /// A continuously growing cache keeping ready-for-diff blobs by their path in the worktree, /// as that is what affects their final diff-able state. /// diff --git a/gix-status/Cargo.toml b/gix-status/Cargo.toml index cd41782d5a3..324ce1fe3c0 100644 --- a/gix-status/Cargo.toml +++ b/gix-status/Cargo.toml @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing with 'git status'-like fu authors = ["Sebastian Thiel ", "Pascal Kuthe "] edition = "2021" include = ["src/**/*", "LICENSE-*"] -rust-version = "1.70" +rust-version = "1.74" autotests = false [lib] diff --git a/gix-status/src/index_as_worktree_with_renames/types.rs b/gix-status/src/index_as_worktree_with_renames/types.rs index ccf17feaf0f..add7717897e 100644 --- a/gix-status/src/index_as_worktree_with_renames/types.rs +++ b/gix-status/src/index_as_worktree_with_renames/types.rs @@ -129,7 +129,9 @@ pub enum Entry<'index, ContentChange, SubmoduleStatus> { /// [CollapsedEntriesEmissionMode::OnStatusMismatch](gix_dir::walk::CollapsedEntriesEmissionMode::OnStatusMismatch). /// It will also be `Some(dir_status)` if that option was [CollapsedEntriesEmissionMode::All](gix_dir::walk::CollapsedEntriesEmissionMode::All). dirwalk_entry_collapsed_directory_status: Option, - /// The object id after the rename, specifically hashed in order to determine equality. + /// The object id as it would appear if the entry was written to the object database, specifically hashed in order to determine equality. + /// Note that it doesn't (necessarily) exist in the object database, and may be [null](gix_hash::ObjectId::null) if no hashing + /// was performed. dirwalk_entry_id: gix_hash::ObjectId, /// 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. diff --git a/gix-status/src/stack.rs b/gix-status/src/stack.rs index ba26d656443..7c72c83f4c0 100644 --- a/gix-status/src/stack.rs +++ b/gix-status/src/stack.rs @@ -1,6 +1,7 @@ -use std::path::{Path, PathBuf}; - +use bstr::BStr; use gix_fs::Stack; +use std::borrow::Cow; +use std::path::{Path, PathBuf}; use crate::SymlinkCheck; @@ -27,6 +28,22 @@ impl SymlinkCheck { self.inner.make_relative_path_current(relative_path, &mut Delegate)?; Ok(self.inner.current()) } + + /// Like [`Self::verified_path()`], but do not fail if there is no directory entry at `relative_path` or on the way + /// to `relative_path`. Instead. + /// For convenience, this incarnation is tuned to be easy to use with Git paths, i.e. slash-separated `BString` path. + pub fn verified_path_allow_nonexisting(&mut self, relative_path: &BStr) -> std::io::Result> { + let rela_path = gix_path::try_from_bstr(relative_path).map_err(std::io::Error::other)?; + if let Err(err) = self.verified_path(&rela_path) { + if err.kind() == std::io::ErrorKind::NotFound { + Ok(Cow::Owned(self.inner.root().join(rela_path))) + } else { + Err(err) + } + } else { + Ok(Cow::Borrowed(self.inner.current())) + } + } } struct Delegate; diff --git a/gix/src/status/index_worktree.rs b/gix/src/status/index_worktree.rs index be64f74e668..27fd952d961 100644 --- a/gix/src/status/index_worktree.rs +++ b/gix/src/status/index_worktree.rs @@ -359,7 +359,9 @@ pub enum Item { /// [CollapsedEntriesEmissionMode::OnStatusMismatch](gix_dir::walk::CollapsedEntriesEmissionMode::OnStatusMismatch). /// It will also be `Some(dir_status)` if that option was [CollapsedEntriesEmissionMode::All](gix_dir::walk::CollapsedEntriesEmissionMode::All). dirwalk_entry_collapsed_directory_status: Option, - /// The object id after the rename, specifically hashed in order to determine equality. + /// The object id as it would appear if the entry was written to the object database, specifically hashed in order to determine equality. + /// Note that it doesn't (necessarily) exist in the object database, and may be [null](gix_hash::ObjectId::null) if no hashing + /// was performed. dirwalk_entry_id: gix_hash::ObjectId, /// 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.