summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/clone/checkout.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/checkout.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/checkout.rs')
-rw-r--r--vendor/gix/src/clone/checkout.rs39
1 files changed, 26 insertions, 13 deletions
diff --git a/vendor/gix/src/clone/checkout.rs b/vendor/gix/src/clone/checkout.rs
index 823005551..ece480a56 100644
--- a/vendor/gix/src/clone/checkout.rs
+++ b/vendor/gix/src/clone/checkout.rs
@@ -26,9 +26,7 @@ pub mod main_worktree {
#[error(transparent)]
CheckoutOptions(#[from] crate::config::checkout_options::Error),
#[error(transparent)]
- IndexCheckout(
- #[from] gix_worktree::checkout::Error<gix_odb::find::existing_object::Error<gix_odb::store::find::Error>>,
- ),
+ IndexCheckout(#[from] gix_worktree_state::checkout::Error<gix_odb::find::existing_object::Error>),
#[error("Failed to reopen object database as Arc (only if thread-safety wasn't compiled in)")]
OpenArcOdb(#[from] std::io::Error),
#[error("The HEAD reference could not be located")]
@@ -64,11 +62,24 @@ pub mod main_worktree {
///
/// Note that this is a no-op if the remote was empty, leaving this repository empty as well. This can be validated by checking
/// if the `head()` of the returned repository is not unborn.
- pub fn main_worktree(
+ pub fn main_worktree<P>(
&mut self,
- mut progress: impl crate::Progress,
+ mut progress: P,
should_interrupt: &AtomicBool,
- ) -> Result<(Repository, gix_worktree::checkout::Outcome), Error> {
+ ) -> Result<(Repository, gix_worktree_state::checkout::Outcome), Error>
+ where
+ P: gix_features::progress::NestedProgress,
+ P::SubProgress: gix_features::progress::NestedProgress + 'static,
+ {
+ self.main_worktree_inner(&mut progress, should_interrupt)
+ }
+
+ fn main_worktree_inner(
+ &mut self,
+ progress: &mut dyn gix_features::progress::DynNestedProgress,
+ should_interrupt: &AtomicBool,
+ ) -> Result<(Repository, gix_worktree_state::checkout::Outcome), Error> {
+ let _span = gix_trace::coarse!("gix::clone::PrepareCheckout::main_worktree()");
let repo = self
.repo
.as_ref()
@@ -81,7 +92,7 @@ pub mod main_worktree {
None => {
return Ok((
self.repo.take().expect("still present"),
- gix_worktree::checkout::Outcome::default(),
+ gix_worktree_state::checkout::Outcome::default(),
))
}
};
@@ -92,25 +103,27 @@ pub mod main_worktree {
})?;
let mut index = gix_index::File::from_state(index, repo.index_path());
- let mut opts = repo.config.checkout_options(repo.git_dir())?;
+ let mut opts = repo
+ .config
+ .checkout_options(repo, gix_worktree::stack::state::attributes::Source::IdMapping)?;
opts.destination_is_initially_empty = true;
- let mut files = progress.add_child_with_id("checkout", ProgressId::CheckoutFiles.into());
- let mut bytes = progress.add_child_with_id("writing", ProgressId::BytesWritten.into());
+ let mut files = progress.add_child_with_id("checkout".to_string(), ProgressId::CheckoutFiles.into());
+ let mut bytes = progress.add_child_with_id("writing".to_string(), ProgressId::BytesWritten.into());
files.init(Some(index.entries().len()), crate::progress::count("files"));
bytes.init(None, crate::progress::bytes());
let start = std::time::Instant::now();
- let outcome = gix_worktree::checkout(
+ let outcome = gix_worktree_state::checkout(
&mut index,
workdir,
{
let objects = repo.objects.clone().into_arc()?;
move |oid, buf| objects.find_blob(oid, buf)
},
- &mut files,
- &mut bytes,
+ &files,
+ &bytes,
should_interrupt,
opts,
)?;