Skip to content

various improvements #1898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gix-diff/src/blob/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion gix-status/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "A crate of the gitoxide project dealing with 'git status'-like fu
authors = ["Sebastian Thiel <[email protected]>", "Pascal Kuthe <[email protected]>"]
edition = "2021"
include = ["src/**/*", "LICENSE-*"]
rust-version = "1.70"
rust-version = "1.74"
autotests = false

[lib]
Expand Down
4 changes: 3 additions & 1 deletion gix-status/src/index_as_worktree_with_renames/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<gix_dir::entry::Status>,
/// 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.
Expand Down
21 changes: 19 additions & 2 deletions gix-status/src/stack.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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<Cow<'_, Path>> {
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;
Expand Down
4 changes: 3 additions & 1 deletion gix/src/status/index_worktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<gix_dir::entry::Status>,
/// 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.
Expand Down
Loading