summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/clone/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix/src/clone/mod.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/clone/mod.rs')
-rw-r--r--vendor/gix/src/clone/mod.rs31
1 files changed, 25 insertions, 6 deletions
diff --git a/vendor/gix/src/clone/mod.rs b/vendor/gix/src/clone/mod.rs
index 9ec226135..8afc3b99b 100644
--- a/vendor/gix/src/clone/mod.rs
+++ b/vendor/gix/src/clone/mod.rs
@@ -68,20 +68,37 @@ impl PrepareFetch {
url: Url,
path: impl AsRef<std::path::Path>,
kind: crate::create::Kind,
- mut create_opts: crate::create::Options,
+ create_opts: crate::create::Options,
open_opts: crate::open::Options,
) -> Result<Self, Error>
where
Url: TryInto<gix_url::Url, Error = E>,
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,
- })?;
+ Self::new_inner(
+ url.try_into().map_err(gix_url::parse::Error::from)?,
+ path.as_ref(),
+ kind,
+ create_opts,
+ open_opts,
+ )
+ }
+
+ #[allow(clippy::result_large_err)]
+ fn new_inner(
+ mut url: gix_url::Url,
+ path: &std::path::Path,
+ kind: crate::create::Kind,
+ mut create_opts: crate::create::Options,
+ open_opts: crate::open::Options,
+ ) -> Result<Self, Error> {
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
@@ -121,6 +138,7 @@ impl PrepareFetch {
/// A utility to collect configuration on how to perform a checkout into a working tree, and when dropped without checking out successfully
/// the fetched repository will be dropped.
#[must_use]
+#[cfg(feature = "worktree-mutation")]
pub struct PrepareCheckout {
/// A freshly initialized repository which is owned by us, or `None` if it was handed to the user
pub(self) repo: Option<crate::Repository>,
@@ -164,4 +182,5 @@ mod access_feat {
pub mod fetch;
///
+#[cfg(feature = "worktree-mutation")]
pub mod checkout;