summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/open
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix/src/open')
-rw-r--r--vendor/gix/src/open/repository.rs31
1 files changed, 21 insertions, 10 deletions
diff --git a/vendor/gix/src/open/repository.rs b/vendor/gix/src/open/repository.rs
index fde647a4e..6c3f07f42 100644
--- a/vendor/gix/src/open/repository.rs
+++ b/vendor/gix/src/open/repository.rs
@@ -8,7 +8,7 @@ use super::{Error, Options};
use crate::{
config,
config::{
- cache::{interpolate_context, util::ApplyLeniency},
+ cache::interpolate_context,
tree::{gitoxide, Core, Key, Safe},
},
open::Permissions,
@@ -237,13 +237,27 @@ 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)?;
- worktree_dir = {
- gix_path::normalize(git_dir.join(wt_path).into(), current_dir)
- .and_then(|wt| wt.as_ref().is_dir().then(|| wt.into_owned()))
+ .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()) {
+ gix_trace::warn!("The configured worktree path '{}' is not a directory or doesn't exist - `core.worktree` may be misleading", worktree_path.display());
}
+ } else if !config.lenient_config
+ && config
+ .resolved
+ .boolean_filter("core", None, Core::WORKTREE.name, &mut filter_config_section)
+ .is_some()
+ {
+ return Err(Error::from(config::Error::ConfigTypedString(
+ config::key::GenericErrorWithValue::from(&Core::WORKTREE),
+ )));
}
}
@@ -259,6 +273,7 @@ impl ThreadSafeRepository {
}
refs.write_reflog = config::cache::util::reflog_or_default(config.reflog, worktree_dir.is_some());
+ refs.namespace = config.refs_namespace.clone();
let replacements = replacement_objects_refs_prefix(&config.resolved, lenient_config, filter_config_section)?
.and_then(|prefix| {
let _span = gix_trace::detail!("find replacement objects");
@@ -310,11 +325,7 @@ fn replacement_objects_refs_prefix(
lenient: bool,
mut filter_config_section: fn(&gix_config::file::Metadata) -> bool,
) -> Result<Option<PathBuf>, Error> {
- let is_disabled = config
- .boolean_filter_by_key("core.useReplaceRefs", &mut filter_config_section)
- .map(|b| Core::USE_REPLACE_REFS.enrich_error(b))
- .transpose()
- .with_leniency(lenient)
+ let is_disabled = config::shared::is_replace_refs_enabled(config, lenient, filter_config_section)
.map_err(config::Error::ConfigBoolean)?
.unwrap_or(true);