summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/clone/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix/src/clone/fetch')
-rw-r--r--vendor/gix/src/clone/fetch/mod.rs21
-rw-r--r--vendor/gix/src/clone/fetch/util.rs12
2 files changed, 19 insertions, 14 deletions
diff --git a/vendor/gix/src/clone/fetch/mod.rs b/vendor/gix/src/clone/fetch/mod.rs
index e20cc96cb..c03b8f839 100644
--- a/vendor/gix/src/clone/fetch/mod.rs
+++ b/vendor/gix/src/clone/fetch/mod.rs
@@ -26,7 +26,7 @@ pub enum Error {
SaveConfigIo(#[from] std::io::Error),
#[error("The remote HEAD points to a reference named {head_ref_name:?} which is invalid.")]
InvalidHeadRef {
- source: gix_validate::refname::Error,
+ source: gix_validate::reference::name::Error,
head_ref_name: crate::bstr::BString,
},
#[error("Failed to update HEAD with values from remote")]
@@ -55,9 +55,18 @@ impl PrepareFetch {
should_interrupt: &std::sync::atomic::AtomicBool,
) -> Result<(crate::Repository, crate::remote::fetch::Outcome), Error>
where
- P: crate::Progress,
+ P: crate::NestedProgress,
P::SubProgress: 'static,
{
+ self.fetch_only_inner(&mut progress, should_interrupt).await
+ }
+
+ #[gix_protocol::maybe_async::maybe_async]
+ async fn fetch_only_inner(
+ &mut self,
+ progress: &mut dyn crate::DynNestedProgress,
+ should_interrupt: &std::sync::atomic::AtomicBool,
+ ) -> Result<(crate::Repository, crate::remote::fetch::Outcome), Error> {
use crate::{bstr::ByteVec, remote, remote::fetch::RefLogMessage};
let repo = self
@@ -111,7 +120,7 @@ impl PrepareFetch {
f(&mut connection).map_err(|err| Error::RemoteConnection(err))?;
}
connection
- .prepare_fetch(&mut progress, {
+ .prepare_fetch(&mut *progress, {
let mut opts = self.fetch_options.clone();
if !opts.extra_refspecs.contains(&head_refspec) {
opts.extra_refspecs.push(head_refspec)
@@ -134,7 +143,7 @@ impl PrepareFetch {
message: reflog_message.clone(),
})
.with_shallow(self.shallow.clone())
- .receive(progress, should_interrupt)
+ .receive_inner(progress, should_interrupt)
.await?;
util::append_config_to_repo_config(repo, config);
@@ -149,14 +158,14 @@ impl PrepareFetch {
}
/// Similar to [`fetch_only()`][Self::fetch_only()`], but passes ownership to a utility type to configure a checkout operation.
- #[cfg(feature = "blocking-network-client")]
+ #[cfg(all(feature = "worktree-mutation", feature = "blocking-network-client"))]
pub fn fetch_then_checkout<P>(
&mut self,
progress: P,
should_interrupt: &std::sync::atomic::AtomicBool,
) -> Result<(crate::clone::PrepareCheckout, crate::remote::fetch::Outcome), Error>
where
- P: crate::Progress,
+ P: crate::NestedProgress,
P::SubProgress: 'static,
{
let (repo, fetch_outcome) = self.fetch_only(progress, should_interrupt)?;
diff --git a/vendor/gix/src/clone/fetch/util.rs b/vendor/gix/src/clone/fetch/util.rs
index cb79669ac..ab90435d0 100644
--- a/vendor/gix/src/clone/fetch/util.rs
+++ b/vendor/gix/src/clone/fetch/util.rs
@@ -51,7 +51,7 @@ fn write_to_local_config(config: &gix_config::File<'static>, mode: WriteMode) ->
.append(matches!(mode, WriteMode::Append))
.open(config.meta().path.as_deref().expect("local config with path set"))?;
local_config.write_all(config.detect_newline_style())?;
- config.write_to_filter(&mut local_config, |s| s.meta().source == gix_config::Source::Local)
+ config.write_to_filter(&mut local_config, &mut |s| s.meta().source == gix_config::Source::Local)
}
pub fn append_config_to_repo_config(repo: &mut Repository, config: gix_config::File<'static>) {
@@ -76,6 +76,7 @@ pub fn update_head(
gix_protocol::handshake::Ref::Symbolic {
full_ref_name,
target,
+ tag: _,
object,
} if full_ref_name == "HEAD" => (Some(object.as_ref()), Some(target)),
gix_protocol::handshake::Ref::Direct { full_ref_name, object } if full_ref_name == "HEAD" => {
@@ -106,12 +107,7 @@ pub fn update_head(
repo.refs
.transaction()
.packed_refs(gix_ref::file::transaction::PackedRefs::DeletionsAndNonSymbolicUpdates(
- Box::new(|oid, buf| {
- repo.objects
- .try_find(oid, buf)
- .map(|obj| obj.map(|obj| obj.kind))
- .map_err(|err| Box::new(err) as Box<dyn std::error::Error + Send + Sync + 'static>)
- }),
+ Box::new(|oid, buf| repo.objects.try_find(&oid, buf).map(|obj| obj.map(|obj| obj.kind))),
))
.prepare(
{
@@ -202,7 +198,7 @@ fn setup_branch_config(
let remote = repo
.find_remote(remote_name)
.expect("remote was just created and must be visible in config");
- let group = gix_refspec::MatchGroup::from_fetch_specs(remote.fetch_specs.iter().map(|s| s.to_ref()));
+ let group = gix_refspec::MatchGroup::from_fetch_specs(remote.fetch_specs.iter().map(gix_refspec::RefSpec::to_ref));
let null = gix_hash::ObjectId::null(repo.object_hash());
let res = group.match_remotes(
Some(gix_refspec::match_group::Item {