Skip to content

Commit

Permalink
adapt to changes in gix-url
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 17, 2023
1 parent 8857580 commit f8fc662
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions gix/src/clone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ impl PrepareFetch {
gix_url::parse::Error: From<E>,
{
let mut url = url.try_into().map_err(gix_url::parse::Error::from)?;
url.canonicalize().map_err(|err| Error::CanonicalizeUrl {
url: url.clone(),
source: err,
})?;
create_opts.destination_must_be_empty = true;
let mut repo = crate::ThreadSafeRepository::init_opts(path, kind, create_opts, open_opts)?.to_thread_local();
url.canonicalize(repo.options.current_dir_or_empty())
.map_err(|err| Error::CanonicalizeUrl {
url: url.clone(),
source: err,
})?;
if repo.committer().is_none() {
let mut config = gix_config::File::new(gix_config::file::Metadata::api());
config
Expand Down
6 changes: 6 additions & 0 deletions gix/src/open/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ impl Options {
}
}

impl Options {
pub(crate) fn current_dir_or_empty(&self) -> &std::path::Path {
self.current_dir.as_deref().unwrap_or(std::path::Path::new(""))
}
}

impl gix_sec::trust::DefaultForLevel for Options {
fn default_for_level(level: gix_sec::Trust) -> Self {
match level {
Expand Down
2 changes: 1 addition & 1 deletion gix/src/pathspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'repo> Pathspec<'repo> {
repo.prefix()?,
&gix_path::realpath_opts(
repo.work_dir().unwrap_or_else(|| repo.git_dir()),
repo.options.current_dir.as_deref().unwrap_or(std::path::Path::new("")),
repo.options.current_dir_or_empty(),
gix_path::realpath::MAX_SYMLINKS,
)?,
)?;
Expand Down

0 comments on commit f8fc662

Please sign in to comment.