Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ gix = { version = "^0.53.1", path = "gix", default-features = false }
time = "0.3.23"

clap = { version = "4.1.1", features = ["derive", "cargo"] }
prodash = { version = "26.2.0", optional = true, default-features = false }
prodash = { workspace = true, optional = true }
is-terminal = { version = "0.4.0", optional = true }
env_logger = { version = "0.10.0", default-features = false }
crosstermion = { version = "0.11.0", optional = true, default-features = false }
Expand Down Expand Up @@ -292,6 +292,9 @@ members = [
"gix-traverse/tests",
]

[workspace.dependencies]
prodash = { version = "26.2.2", default-features = false }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nice! Thanks for introducing this feature!


[package.metadata.docs.rs]
features = ["document-features", "max"]
rustdoc-args = ["--cfg", "docsrs"]
2 changes: 1 addition & 1 deletion gix-features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ crc32fast = { version = "1.2.1", optional = true }
sha1 = { version = "0.10.0", optional = true }

# progress
prodash = { version = "26.2.0", optional = true, default-features = false }
prodash = { workspace = true, optional = true }
bytesize = { version = "1.0.1", optional = true }

# pipe
Expand Down
3 changes: 2 additions & 1 deletion gix-features/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ pub use prodash::{
progress::{
AtomicStep, Discard, DoOrDiscard, Either, Id, Step, StepShared, Task, ThroughputOnDrop, Value, UNKNOWN,
},
unit, Count, DynNestedProgress, NestedProgress, Progress, Unit,
unit, BoxedDynNestedProgress, Count, DynNestedProgress, DynNestedProgressToNestedProgress, NestedProgress,
Progress, Unit,
};
/// A stub for the portions of the `bytesize` crate that we use internally in `gitoxide`.
#[cfg(not(feature = "progress-unit-bytes"))]
Expand Down
2 changes: 1 addition & 1 deletion gix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ gix-protocol = { version = "^0.39.0", path = "../gix-protocol", optional = true
gix-transport = { version = "^0.36.0", path = "../gix-transport", optional = true }

# Just to get the progress-tree feature
prodash = { version = "26.2", optional = true, default-features = false, features = ["progress-tree"] }
prodash = { workspace = true, optional = true, features = ["progress-tree"] }
once_cell = "1.14.0"
signal-hook = { version = "0.3.9", default-features = false, optional = true }
thiserror = "1.0.26"
Expand Down
13 changes: 11 additions & 2 deletions gix/src/clone/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ impl PrepareFetch {
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
Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub use gix_features as features;
use gix_features::threading::OwnShared;
pub use gix_features::{
parallel,
progress::{Count, NestedProgress, Progress},
progress::{Count, DynNestedProgress, NestedProgress, Progress},
threading,
};
pub use gix_fs as fs;
Expand Down
25 changes: 15 additions & 10 deletions gix/src/remote/connection/fetch/receive_pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,28 @@ where
/// - `gitoxide.userAgent` is read to obtain the application user agent for git servers and for HTTP servers as well.
///
#[gix_protocol::maybe_async::maybe_async]
#[allow(clippy::drop_non_drop)]
pub async fn receive<P>(mut self, mut progress: P, should_interrupt: &AtomicBool) -> Result<Outcome, Error>
pub async fn receive<P>(self, mut progress: P, should_interrupt: &AtomicBool) -> Result<Outcome, Error>
where
P: gix_features::progress::NestedProgress,
P::SubProgress: 'static,
{
self.receive_inner(&mut progress, should_interrupt).await
}

#[gix_protocol::maybe_async::maybe_async]
#[allow(clippy::drop_non_drop)]
pub(crate) async fn receive_inner(
mut self,
progress: &mut dyn crate::DynNestedProgress,
should_interrupt: &AtomicBool,
) -> Result<Outcome, Error> {
let _span = gix_trace::coarse!("fetch::Prepare::receive()");
let mut con = self.con.take().expect("receive() can only be called once");

let handshake = &self.ref_map.handshake;
let protocol_version = handshake.server_protocol_version;

let fetch = gix_protocol::Command::Fetch;
let progress = &mut progress;
let repo = con.remote.repo;
let fetch_features = {
let mut f = fetch.default_features(protocol_version, &handshake.capabilities);
Expand Down Expand Up @@ -379,17 +387,14 @@ fn add_shallow_args(
Ok((shallow_commits, shallow_lock))
}

fn setup_remote_progress<P>(
progress: &mut P,
fn setup_remote_progress(
progress: &mut dyn crate::DynNestedProgress,
reader: &mut Box<dyn gix_protocol::transport::client::ExtendedBufRead + Unpin + '_>,
should_interrupt: &AtomicBool,
) where
P: gix_features::progress::NestedProgress,
P::SubProgress: 'static,
{
) {
use gix_protocol::transport::client::ExtendedBufRead;
reader.set_progress_handler(Some(Box::new({
let mut remote_progress = progress.add_child_with_id("remote", ProgressId::RemoteProgress.into());
let mut remote_progress = progress.add_child_with_id("remote".to_string(), ProgressId::RemoteProgress.into());
// SAFETY: Ugh, so, with current Rust I can't declare lifetimes in the involved traits the way they need to
// be and I also can't use scoped threads to pump from local scopes to an Arc version that could be
// used here due to the this being called from sync AND async code (and the async version doesn't work
Expand Down