Skip to content

Commit a0655dc

Browse files
committed
upgrade to prodash v21 (#450)
1 parent f869b22 commit a0655dc

File tree

13 files changed

+77
-38
lines changed

13 files changed

+77
-38
lines changed

Diff for: Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ git-repository = { version = "^0.25.0", path = "git-repository", default-feature
8686
git-transport-for-configuration-only = { package = "git-transport", optional = true, version = "^0.21.0", path = "git-transport" }
8787

8888
clap = { version = "3.2.5", features = ["derive", "cargo"] }
89-
prodash = { version = "20.2.0", optional = true, default-features = false }
89+
prodash = { version = "21", optional = true, default-features = false }
9090
atty = { version = "0.2.14", optional = true, default-features = false }
9191
env_logger = { version = "0.9.0", default-features = false }
9292
crosstermion = { version = "0.10.1", optional = true, default-features = false }

Diff for: git-features/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ crc32fast = { version = "1.2.1", optional = true }
118118
sha1 = { version = "0.10.0", optional = true }
119119

120120
# progress
121-
prodash = { version = "20.2.0", optional = true, default-features = false, features = ["unit-bytes", "unit-human"] }
121+
prodash = { version = "21", optional = true, default-features = false, features = ["unit-bytes", "unit-human"] }
122122

123123
# pipe
124124
bytes = { version = "1.0.0", optional = true }

Diff for: git-pack/src/bundle/write/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,19 @@ impl crate::Bundle {
144144
/// As it sends portions of the input to a thread it requires the 'static lifetime for the interrupt flags. This can only
145145
/// be satisfied by a static AtomicBool which is only suitable for programs that only run one of these operations at a time
146146
/// or don't mind that all of them abort when the flag is set.
147-
pub fn write_to_directory_eagerly(
147+
pub fn write_to_directory_eagerly<P>(
148148
pack: impl io::Read + Send + 'static,
149149
pack_size: Option<u64>,
150150
directory: Option<impl AsRef<Path>>,
151-
mut progress: impl Progress,
151+
mut progress: P,
152152
should_interrupt: &'static AtomicBool,
153153
thin_pack_base_object_lookup_fn: Option<ThinPackLookupFnSend>,
154154
options: Options,
155-
) -> Result<Outcome, Error> {
155+
) -> Result<Outcome, Error>
156+
where
157+
P: Progress,
158+
<P as Progress>::SubProgress: 'static,
159+
{
156160
let mut read_progress = progress.add_child("read pack");
157161
read_progress.init(pack_size.map(|s| s as usize), progress::bytes());
158162
let pack = progress::Read {

Diff for: git-pack/src/data/output/entry/iter_from_counts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::data::output;
3636
pub fn iter_from_counts<Find>(
3737
mut counts: Vec<output::Count>,
3838
db: Find,
39-
mut progress: impl Progress,
39+
mut progress: impl Progress + 'static,
4040
Options {
4141
version,
4242
mode,

Diff for: git-protocol/src/fetch_fn.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,19 @@ impl Default for FetchConnection {
4444
///
4545
/// _Note_ that depending on the `delegate`, the actual action performed can be `ls-refs`, `clone` or `fetch`.
4646
#[maybe_async]
47-
pub async fn fetch<F, D, T>(
47+
pub async fn fetch<F, D, T, P>(
4848
mut transport: T,
4949
mut delegate: D,
5050
authenticate: F,
51-
mut progress: impl Progress,
51+
mut progress: P,
5252
fetch_mode: FetchConnection,
5353
) -> Result<(), Error>
5454
where
5555
F: FnMut(credentials::helper::Action) -> credentials::protocol::Result,
5656
D: Delegate,
5757
T: client::Transport,
58+
P: Progress,
59+
<P as Progress>::SubProgress: 'static,
5860
{
5961
let handshake::Outcome {
6062
server_protocol_version: protocol_version,
@@ -141,10 +143,11 @@ where
141143
Ok(())
142144
}
143145

144-
fn setup_remote_progress(
145-
progress: &mut impl Progress,
146-
reader: &mut Box<dyn git_transport::client::ExtendedBufRead + Unpin + '_>,
147-
) {
146+
fn setup_remote_progress<T>(progress: &mut T, reader: &mut Box<dyn git_transport::client::ExtendedBufRead + Unpin + '_>)
147+
where
148+
T: Progress,
149+
<T as Progress>::SubProgress: 'static,
150+
{
148151
reader.set_progress_handler(Some(Box::new({
149152
let mut remote_progress = progress.add_child("remote");
150153
move |is_err: bool, data: &[u8]| {

Diff for: git-repository/src/clone/fetch.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ impl PrepareFetch {
4141
///
4242
/// Note that all data we created will be removed once this instance drops if the operation wasn't successful.
4343
#[cfg(feature = "blocking-network-client")]
44-
pub fn fetch_only(
44+
pub fn fetch_only<P>(
4545
&mut self,
46-
progress: impl crate::Progress,
46+
progress: P,
4747
should_interrupt: &std::sync::atomic::AtomicBool,
48-
) -> Result<(Repository, crate::remote::fetch::Outcome), Error> {
48+
) -> Result<(Repository, crate::remote::fetch::Outcome), Error>
49+
where
50+
P: crate::Progress,
51+
<P as crate::Progress>::SubProgress: 'static,
52+
{
4953
fn replace_changed_local_config(repo: &mut Repository, config: git_config::File<'static>) {
5054
let repo_config = git_features::threading::OwnShared::make_mut(&mut repo.config.resolved);
5155
let ids_to_remove: Vec<_> = repo_config
@@ -189,11 +193,15 @@ impl PrepareFetch {
189193

190194
/// Similar to [`fetch_only()`][Self::fetch_only()`], but passes ownership to a utility type to configure a checkout operation.
191195
#[cfg(feature = "blocking-network-client")]
192-
pub fn fetch_then_checkout(
196+
pub fn fetch_then_checkout<P>(
193197
&mut self,
194-
progress: impl crate::Progress,
198+
progress: P,
195199
should_interrupt: &std::sync::atomic::AtomicBool,
196-
) -> Result<(crate::clone::PrepareCheckout, crate::remote::fetch::Outcome), Error> {
200+
) -> Result<(crate::clone::PrepareCheckout, crate::remote::fetch::Outcome), Error>
201+
where
202+
P: crate::Progress,
203+
<P as crate::Progress>::SubProgress: 'static,
204+
{
197205
let (repo, fetch_outcome) = self.fetch_only(progress, should_interrupt)?;
198206
Ok((crate::clone::PrepareCheckout { repo: repo.into() }, fetch_outcome))
199207
}

Diff for: git-repository/src/remote/connection/fetch/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>
131131
where
132132
T: Transport,
133133
P: Progress,
134+
<P as Progress>::SubProgress: 'static,
134135
{
135136
/// Receive the pack and perform the operation as configured by git via `git-config` or overridden by various builder methods.
136137
/// Return `Ok(None)` if there was nothing to do because all remote refs are at the same state as they are locally, or `Ok(Some(outcome))`
@@ -267,10 +268,13 @@ where
267268
}
268269
}
269270

270-
fn setup_remote_progress(
271-
progress: &mut impl Progress,
271+
fn setup_remote_progress<P>(
272+
progress: &mut P,
272273
reader: &mut Box<dyn git_protocol::transport::client::ExtendedBufRead + Unpin + '_>,
273-
) {
274+
) where
275+
P: Progress,
276+
<P as Progress>::SubProgress: 'static,
277+
{
274278
use git_protocol::transport::client::ExtendedBufRead;
275279
reader.set_progress_handler(Some(Box::new({
276280
let mut remote_progress = progress.add_child("remote");

Diff for: gitoxide-core/src/pack/create.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ pub struct Context<W> {
9696
pub out: W,
9797
}
9898

99-
pub fn create<W>(
99+
pub fn create<W, P>(
100100
repository_path: impl AsRef<Path>,
101101
tips: impl IntoIterator<Item = impl AsRef<OsStr>>,
102102
input: Option<impl io::BufRead + Send + 'static>,
103103
output_directory: Option<impl AsRef<Path>>,
104-
mut progress: impl Progress,
104+
mut progress: P,
105105
Context {
106106
expansion,
107107
nondeterministic_thread_count,
@@ -115,6 +115,8 @@ pub fn create<W>(
115115
) -> anyhow::Result<()>
116116
where
117117
W: std::io::Write,
118+
P: Progress,
119+
P::SubProgress: 'static,
118120
{
119121
let repo = git::discover(repository_path)?.into_sync();
120122
progress.init(Some(2), progress::steps());

Diff for: gitoxide-core/src/pack/index.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ pub enum PathOrRead {
7575
Read(Box<dyn std::io::Read + Send + 'static>),
7676
}
7777

78-
pub fn from_pack(
78+
pub fn from_pack<P>(
7979
pack: PathOrRead,
8080
directory: Option<PathBuf>,
81-
progress: impl Progress,
81+
progress: P,
8282
ctx: Context<'static, impl io::Write>,
83-
) -> anyhow::Result<()> {
83+
) -> anyhow::Result<()>
84+
where
85+
P: Progress,
86+
P::SubProgress: 'static,
87+
{
8488
use anyhow::Context;
8589
let options = pack::bundle::write::Options {
8690
thread_limit: ctx.thread_limit,

Diff for: gitoxide-core/src/pack/receive.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,20 @@ mod blocking_io {
142142
}
143143
}
144144

145-
pub fn receive<P: Progress, W: io::Write>(
145+
pub fn receive<P, W>(
146146
protocol: Option<net::Protocol>,
147147
url: &str,
148148
directory: Option<PathBuf>,
149149
refs_directory: Option<PathBuf>,
150150
wanted_refs: Vec<BString>,
151151
progress: P,
152152
ctx: Context<W>,
153-
) -> anyhow::Result<()> {
153+
) -> anyhow::Result<()>
154+
where
155+
W: std::io::Write,
156+
P: Progress,
157+
P::SubProgress: 'static,
158+
{
154159
let transport = net::connect(url, protocol.unwrap_or_default().into())?;
155160
let delegate = CloneDelegate {
156161
ctx,

Diff for: gitoxide-core/src/repository/clone.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,29 @@ pub(crate) mod function {
1212
use anyhow::bail;
1313
use git_repository as git;
1414
use git_repository::remote::fetch::Status;
15+
use git_repository::Progress;
1516
use std::ffi::OsStr;
1617

1718
use super::Options;
1819
use crate::repository::fetch::function::print_updates;
1920
use crate::OutputFormat;
2021

21-
pub fn clone(
22+
pub fn clone<P>(
2223
remote: impl AsRef<OsStr>,
2324
directory: impl AsRef<std::path::Path>,
24-
mut progress: impl git::Progress,
25+
mut progress: P,
2526
mut out: impl std::io::Write,
2627
err: impl std::io::Write,
2728
Options {
2829
format,
2930
handshake_info,
3031
bare,
3132
}: Options,
32-
) -> anyhow::Result<()> {
33+
) -> anyhow::Result<()>
34+
where
35+
P: Progress,
36+
P::SubProgress: 'static,
37+
{
3338
if format != OutputFormat::Human {
3439
bail!("JSON output isn't yet supported for fetching.");
3540
}
@@ -48,7 +53,7 @@ pub(crate) mod function {
4853
},
4954
)?;
5055
let (mut checkout, fetch_outcome) =
51-
prepare.fetch_then_checkout(progress.add_child("fetch"), &git::interrupt::IS_INTERRUPTED)?;
56+
prepare.fetch_then_checkout(&mut progress, &git::interrupt::IS_INTERRUPTED)?;
5257

5358
if handshake_info {
5459
writeln!(out, "Handshake Information")?;
@@ -89,7 +94,7 @@ pub(crate) mod function {
8994
let repo = if bare {
9095
checkout.persist()
9196
} else {
92-
checkout.main_worktree(progress.add_child("clone"), &git::interrupt::IS_INTERRUPTED)?
97+
checkout.main_worktree(progress, &git::interrupt::IS_INTERRUPTED)?
9398
};
9499
writeln!(
95100
out,

Diff for: gitoxide-core/src/repository/fetch.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ pub(crate) mod function {
2222
use super::Options;
2323
use crate::OutputFormat;
2424

25-
pub fn fetch(
25+
pub fn fetch<P>(
2626
repo: git::Repository,
27-
progress: impl git::Progress,
27+
progress: P,
2828
mut out: impl std::io::Write,
2929
err: impl std::io::Write,
3030
Options {
@@ -34,7 +34,11 @@ pub(crate) mod function {
3434
handshake_info,
3535
ref_specs,
3636
}: Options,
37-
) -> anyhow::Result<()> {
37+
) -> anyhow::Result<()>
38+
where
39+
P: git::Progress,
40+
P::SubProgress: 'static,
41+
{
3842
if format != OutputFormat::Human {
3943
bail!("JSON output isn't yet supported for fetching.");
4044
}

0 commit comments

Comments
 (0)