upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/push.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-17 13:23:22 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-17 13:23:22 +0100
commita4bcaf98cc7a00a71f34ed382dc65414eaec5bff (patch)
tree661bcac2b381d232be2488248bc899c48e50fb7e /src/bin/git_remote_nostr/push.rs
parent12fb184cd1a875704d4f187531aa1638513a3dab (diff)
feat(remote): store successful protocol in config
if another protocol was tried first and failed
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
-rw-r--r--src/bin/git_remote_nostr/push.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index daa7973..de18828 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -41,7 +41,7 @@ use crate::{
41 utils::{ 41 utils::{
42 find_proposal_and_patches_by_branch_name, get_all_proposals, get_remote_name_by_url, 42 find_proposal_and_patches_by_branch_name, get_all_proposals, get_remote_name_by_url,
43 get_short_git_server_name, get_write_protocols_to_try, join_with_and, 43 get_short_git_server_name, get_write_protocols_to_try, join_with_and,
44 push_error_is_not_authentication_failure, read_line, 44 push_error_is_not_authentication_failure, read_line, set_protocol_preference, Direction,
45 }, 45 },
46}; 46};
47 47
@@ -351,7 +351,7 @@ fn push_to_remote(
351 term: &Term, 351 term: &Term,
352) -> Result<()> { 352) -> Result<()> {
353 let server_url = git_server_url.parse::<CloneUrl>()?; 353 let server_url = git_server_url.parse::<CloneUrl>()?;
354 let protocols_to_attempt = get_write_protocols_to_try(&server_url, decoded_nostr_url); 354 let protocols_to_attempt = get_write_protocols_to_try(git_repo, &server_url, decoded_nostr_url);
355 355
356 let mut failed_protocols = vec![]; 356 let mut failed_protocols = vec![];
357 let mut success = false; 357 let mut success = false;
@@ -373,6 +373,7 @@ fn push_to_remote(
373 success = true; 373 success = true;
374 if !failed_protocols.is_empty() { 374 if !failed_protocols.is_empty() {
375 term.write_line(format!("fetch: succeeded over {protocol}").as_str())?; 375 term.write_line(format!("fetch: succeeded over {protocol}").as_str())?;
376 let _ = set_protocol_preference(git_repo, protocol, &server_url, &Direction::Push);
376 } 377 }
377 } 378 }
378 term.clear_last_lines(1)?; 379 term.clear_last_lines(1)?;