Skip to content

Commit b230078

Browse files
committed
fix: in --trace mode, greatly increase message-buffer size.
That way, it's much less likely that messages will get lost due to being overwritten before they can be displayed every 100ms or so.
1 parent 16170d9 commit b230078

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/plumbing/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub mod async_util {
3131

3232
pub fn prepare(
3333
verbose: bool,
34+
trace: bool,
3435
name: &str,
3536
range: impl Into<Option<ProgressRange>>,
3637
) -> (
@@ -41,7 +42,7 @@ pub mod async_util {
4142
shared::init_env_logger();
4243

4344
if verbose {
44-
let progress = shared::progress_tree();
45+
let progress = shared::progress_tree(trace);
4546
let sub_progress = progress.add_child(name);
4647
let ui_handle = shared::setup_line_renderer_range(&progress, range.into().unwrap_or(STANDARD_RANGE));
4748
(Some(ui_handle), Some(sub_progress).into())
@@ -416,6 +417,7 @@ pub fn main() -> Result<()> {
416417
{
417418
let (_handle, progress) = async_util::prepare(
418419
auto_verbose,
420+
trace,
419421
"remote-refs",
420422
Some(core::repository::remote::refs::PROGRESS_RANGE),
421423
);
@@ -626,7 +628,7 @@ pub fn main() -> Result<()> {
626628
refs_directory,
627629
} => {
628630
let (_handle, progress) =
629-
async_util::prepare(verbose, "pack-receive", core::pack::receive::PROGRESS_RANGE);
631+
async_util::prepare(verbose, trace, "pack-receive", core::pack::receive::PROGRESS_RANGE);
630632
let fut = core::pack::receive(
631633
protocol,
632634
&url,

src/shared.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ pub fn init_env_logger() {
2020
}
2121

2222
#[cfg(feature = "prodash-render-line")]
23-
pub fn progress_tree() -> std::sync::Arc<prodash::tree::Root> {
23+
pub fn progress_tree(trace: bool) -> std::sync::Arc<prodash::tree::Root> {
2424
prodash::tree::root::Options {
25-
message_buffer_capacity: 200,
25+
message_buffer_capacity: if trace { 10_000 } else { 200 },
2626
..Default::default()
2727
}
2828
.into()
@@ -55,7 +55,7 @@ pub mod pretty {
5555
#[cfg(feature = "small")]
5656
pub fn prepare_and_run<T>(
5757
name: &str,
58-
_trace: bool,
58+
trace: bool,
5959
verbose: bool,
6060
progress: bool,
6161
#[cfg_attr(not(feature = "prodash-render-tui"), allow(unused_variables))] progress_keep_open: bool,
@@ -77,7 +77,7 @@ pub mod pretty {
7777
run(progress::DoOrDiscard::from(None), &mut stdout_lock, &mut stderr_lock)
7878
}
7979
(true, false) => {
80-
let progress = crate::shared::progress_tree();
80+
let progress = crate::shared::progress_tree(trace);
8181
let sub_progress = progress.add_child(name);
8282

8383
use crate::shared::{self, STANDARD_RANGE};
@@ -157,7 +157,7 @@ pub mod pretty {
157157
}
158158
(true, false) => {
159159
use crate::shared::{self, STANDARD_RANGE};
160-
let progress = shared::progress_tree();
160+
let progress = shared::progress_tree(trace);
161161
let sub_progress = progress.add_child(name);
162162
init_tracing(trace, false, &progress)?;
163163

0 commit comments

Comments
 (0)