diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-12 15:13:50 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-12 15:13:50 +0100 |
| commit | e882fde7d3fc7f2113196585b450f7065061abb9 (patch) | |
| tree | 222ecde50be06a5873a3080762c072b28f50666c /src/bin/git_remote_nostr/push.rs | |
| parent | 1a38f98807a3244b77d2525136f3d6976f61dcc4 (diff) | |
fix(remote): improve `push` status updates
to bring them more into line to the native git client
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 7f63eb0..5a19bb0 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -38,7 +38,8 @@ use crate::{ | |||
| 38 | utils::{ | 38 | utils::{ |
| 39 | find_proposal_and_patches_by_branch_name, get_all_proposals, get_remote_name_by_url, | 39 | find_proposal_and_patches_by_branch_name, get_all_proposals, get_remote_name_by_url, |
| 40 | get_short_git_server_name, get_write_protocols_to_try, join_with_and, | 40 | get_short_git_server_name, get_write_protocols_to_try, join_with_and, |
| 41 | push_error_is_not_authentication_failure, read_line, | 41 | push_error_is_not_authentication_failure, read_line, report_on_sideband_progress, |
| 42 | report_on_transfer_progress, ProgressStatus, TransferDirection, | ||
| 42 | }, | 43 | }, |
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| @@ -355,7 +356,11 @@ fn push_to_remote( | |||
| 355 | 356 | ||
| 356 | for protocol in &protocols_to_attempt { | 357 | for protocol in &protocols_to_attempt { |
| 357 | term.write_line( | 358 | term.write_line( |
| 358 | format!("fetching {} ref list over {protocol}...", server_url.short_name(),).as_str(), | 359 | format!( |
| 360 | "fetching {} ref list over {protocol}...", | ||
| 361 | server_url.short_name(), | ||
| 362 | ) | ||
| 363 | .as_str(), | ||
| 359 | )?; | 364 | )?; |
| 360 | 365 | ||
| 361 | let formatted_url = server_url.format_as(protocol, &decoded_nostr_url.user)?; | 366 | let formatted_url = server_url.format_as(protocol, &decoded_nostr_url.user)?; |
| @@ -419,6 +424,20 @@ fn push_to_remote_url( | |||
| 419 | } | 424 | } |
| 420 | Ok(()) | 425 | Ok(()) |
| 421 | }); | 426 | }); |
| 427 | remote_callbacks.transfer_progress(|stats| { | ||
| 428 | let _ = term.clear_last_lines(1); | ||
| 429 | report_on_transfer_progress( | ||
| 430 | &stats, | ||
| 431 | term, | ||
| 432 | TransferDirection::Push, | ||
| 433 | ProgressStatus::InProgress, | ||
| 434 | ); | ||
| 435 | true | ||
| 436 | }); | ||
| 437 | remote_callbacks.sideband_progress(|data| { | ||
| 438 | report_on_sideband_progress(data, term); | ||
| 439 | true | ||
| 440 | }); | ||
| 422 | push_options.remote_callbacks(remote_callbacks); | 441 | push_options.remote_callbacks(remote_callbacks); |
| 423 | git_server_remote.push(remote_refspecs, Some(&mut push_options))?; | 442 | git_server_remote.push(remote_refspecs, Some(&mut push_options))?; |
| 424 | let _ = git_server_remote.disconnect(); | 443 | let _ = git_server_remote.disconnect(); |