From a4bcaf98cc7a00a71f34ed382dc65414eaec5bff Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 17 Sep 2024 13:23:22 +0100 Subject: feat(remote): store successful protocol in config if another protocol was tried first and failed --- src/bin/git_remote_nostr/list.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/bin/git_remote_nostr/list.rs') diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index c2bd9d6..959b8c8 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs @@ -24,6 +24,7 @@ use crate::{ utils::{ fetch_or_list_error_is_not_authentication_failure, get_open_proposals, get_read_protocols_to_try, get_short_git_server_name, join_with_and, + set_protocol_preference, Direction, }, }; @@ -157,7 +158,7 @@ pub fn list_from_remote( decoded_nostr_url: &NostrUrlDecoded, // Add this parameter ) -> Result> { let server_url = git_server_url.parse::()?; - let protocols_to_attempt = get_read_protocols_to_try(&server_url, decoded_nostr_url); + let protocols_to_attempt = get_read_protocols_to_try(git_repo, &server_url, decoded_nostr_url); let mut failed_protocols = vec![]; let mut remote_state: Option> = None; @@ -191,6 +192,8 @@ pub fn list_from_remote( ) .as_str(), )?; + let _ = + set_protocol_preference(git_repo, protocol, &server_url, &Direction::Fetch); } break; } -- cgit v1.2.3