diff --git a/gix/src/config/mod.rs b/gix/src/config/mod.rs index 102c7a48286..438c54378a9 100644 --- a/gix/src/config/mod.rs +++ b/gix/src/config/mod.rs @@ -91,8 +91,11 @@ pub enum Error { ResolveIncludes(#[from] gix_config::file::includes::Error), #[error(transparent)] FromEnv(#[from] gix_config::file::init::from_env::Error), - #[error(transparent)] - PathInterpolation(#[from] gix_config::path::interpolate::Error), + #[error("The path {path:?} at the 'core.worktree' configuration could not be interpolated")] + PathInterpolation { + path: BString, + source: gix_config::path::interpolate::Error, + }, #[error("{source:?} configuration overrides at open or init time could not be applied.")] ConfigOverrides { #[source] diff --git a/gix/src/open/repository.rs b/gix/src/open/repository.rs index 15b8b9ac367..a9150a1ee54 100644 --- a/gix/src/open/repository.rs +++ b/gix/src/open/repository.rs @@ -237,9 +237,13 @@ impl ThreadSafeRepository { .resolved .path_filter("core", None, Core::WORKTREE.name, &mut filter_config_section) { + let wt_clone = wt.clone(); let wt_path = wt .interpolate(interpolate_context(git_install_dir.as_deref(), home.as_deref())) - .map_err(config::Error::PathInterpolation)?; + .map_err(|err| config::Error::PathInterpolation { + path: wt_clone.value.into_owned(), + source: err, + })?; worktree_dir = gix_path::normalize(git_dir.join(wt_path).into(), current_dir).map(Cow::into_owned); #[allow(unused_variables)] if let Some(worktree_path) = worktree_dir.as_deref().filter(|wtd| !wtd.is_dir()) { diff --git a/gix/tests/repository/open.rs b/gix/tests/repository/open.rs index 8c532af3bb4..6868df93cff 100644 --- a/gix/tests/repository/open.rs +++ b/gix/tests/repository/open.rs @@ -74,7 +74,7 @@ fn non_bare_split_worktree_invalid_worktree_path_empty() -> crate::Result { ) .unwrap_err(); assert!( - matches!(err, gix::open::Error::Config(gix::config::Error::PathInterpolation(_))), + matches!(err, gix::open::Error::Config(gix::config::Error::PathInterpolation{..})), "DEVIATION: could not read path at core.worktree as empty is always invalid, git tries to use an empty path, even though it's better to reject it" ); Ok(())