upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/utils.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-13 20:55:12 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-13 20:55:12 +0100
commitfb48125595af09c557d03013e4e096d1d072e791 (patch)
tree7011c39d48fb44b8bc39b6b7ee5a1e825290d971 /src/bin/git_remote_nostr/utils.rs
parentb685eefd3ca2821cba3d740d6f114db2d9649a5a (diff)
fix(remote): add robustness to push reporting
by avoiding bugs where lines are removed accidentally by storing report in a mutex and rewriting the entire report at each update
Diffstat (limited to 'src/bin/git_remote_nostr/utils.rs')
-rw-r--r--src/bin/git_remote_nostr/utils.rs18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index bbe7cfa..a13d398 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -293,24 +293,6 @@ pub fn error_might_be_authentication_related(error: &anyhow::Error) -> bool {
293 false 293 false
294} 294}
295 295
296pub fn report_on_sideband_progress(data: &[u8], term: &console::Term) {
297 if let Ok(data) = str::from_utf8(data) {
298 let data = data
299 .split(['\n', '\r'])
300 .find(|line| !line.is_empty())
301 .unwrap_or("");
302 if !data.is_empty() {
303 let s = format!("remote: {data}");
304 let _ = term.clear_last_lines(1);
305 let _ = term.write_line(s.as_str());
306 if !s.contains('%') || s.contains("100%") {
307 // print it twice so the next sideband_progress doesn't delete it
308 let _ = term.write_line(s.as_str());
309 }
310 }
311 }
312}
313
314#[cfg(test)] 296#[cfg(test)]
315mod tests { 297mod tests {
316 use super::*; 298 use super::*;