diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-17 13:23:22 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-17 13:23:22 +0100 |
| commit | a4bcaf98cc7a00a71f34ed382dc65414eaec5bff (patch) | |
| tree | 661bcac2b381d232be2488248bc899c48e50fb7e /src/bin/git_remote_nostr/list.rs | |
| parent | 12fb184cd1a875704d4f187531aa1638513a3dab (diff) | |
feat(remote): store successful protocol in config
if another protocol was tried first and failed
Diffstat (limited to 'src/bin/git_remote_nostr/list.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/list.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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::{ | |||
| 24 | utils::{ | 24 | utils::{ |
| 25 | fetch_or_list_error_is_not_authentication_failure, get_open_proposals, | 25 | fetch_or_list_error_is_not_authentication_failure, get_open_proposals, |
| 26 | get_read_protocols_to_try, get_short_git_server_name, join_with_and, | 26 | get_read_protocols_to_try, get_short_git_server_name, join_with_and, |
| 27 | set_protocol_preference, Direction, | ||
| 27 | }, | 28 | }, |
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| @@ -157,7 +158,7 @@ pub fn list_from_remote( | |||
| 157 | decoded_nostr_url: &NostrUrlDecoded, // Add this parameter | 158 | decoded_nostr_url: &NostrUrlDecoded, // Add this parameter |
| 158 | ) -> Result<HashMap<String, String>> { | 159 | ) -> Result<HashMap<String, String>> { |
| 159 | let server_url = git_server_url.parse::<CloneUrl>()?; | 160 | let server_url = git_server_url.parse::<CloneUrl>()?; |
| 160 | let protocols_to_attempt = get_read_protocols_to_try(&server_url, decoded_nostr_url); | 161 | let protocols_to_attempt = get_read_protocols_to_try(git_repo, &server_url, decoded_nostr_url); |
| 161 | 162 | ||
| 162 | let mut failed_protocols = vec![]; | 163 | let mut failed_protocols = vec![]; |
| 163 | let mut remote_state: Option<HashMap<String, String>> = None; | 164 | let mut remote_state: Option<HashMap<String, String>> = None; |
| @@ -191,6 +192,8 @@ pub fn list_from_remote( | |||
| 191 | ) | 192 | ) |
| 192 | .as_str(), | 193 | .as_str(), |
| 193 | )?; | 194 | )?; |
| 195 | let _ = | ||
| 196 | set_protocol_preference(git_repo, protocol, &server_url, &Direction::Fetch); | ||
| 194 | } | 197 | } |
| 195 | break; | 198 | break; |
| 196 | } | 199 | } |