diff options
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 9e54ca7..04fc4d8 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -25,7 +25,7 @@ use ngit::{ | |||
| 25 | }, | 25 | }, |
| 26 | git_events::{self, event_to_cover_letter, get_event_root}, | 26 | git_events::{self, event_to_cover_letter, get_event_root}, |
| 27 | login::{self, user::UserRef}, | 27 | login::{self, user::UserRef}, |
| 28 | repo_ref::{self, get_repo_config_from_yaml, is_ngit_relay}, | 28 | repo_ref::{self, get_repo_config_from_yaml, is_grasp_server}, |
| 29 | repo_state, | 29 | repo_state, |
| 30 | }; | 30 | }; |
| 31 | use nostr::nips::nip10::Marker; | 31 | use nostr::nips::nip10::Marker; |
| @@ -79,7 +79,7 @@ pub async fn run_push( | |||
| 79 | git_repo, | 79 | git_repo, |
| 80 | &repo_ref.git_server, | 80 | &repo_ref.git_server, |
| 81 | &repo_ref.to_nostr_git_url(&None), | 81 | &repo_ref.to_nostr_git_url(&None), |
| 82 | &repo_ref.ngit_relays(), | 82 | &repo_ref.grasp_servers(), |
| 83 | ) | 83 | ) |
| 84 | }); | 84 | }); |
| 85 | 85 | ||
| @@ -92,7 +92,7 @@ pub async fn run_push( | |||
| 92 | .iter() | 92 | .iter() |
| 93 | .find(|&url| list_outputs.contains_key(url)) | 93 | .find(|&url| list_outputs.contains_key(url)) |
| 94 | { | 94 | { |
| 95 | let (state, _is_ngit_relay) = list_outputs.get(url).unwrap().to_owned(); | 95 | let (state, _is_grasp_server) = list_outputs.get(url).unwrap().to_owned(); |
| 96 | state | 96 | state |
| 97 | } else { | 97 | } else { |
| 98 | bail!( | 98 | bail!( |
| @@ -163,7 +163,7 @@ pub async fn run_push( | |||
| 163 | &repo_ref.to_nostr_git_url(&None), | 163 | &repo_ref.to_nostr_git_url(&None), |
| 164 | &remote_refspecs, | 164 | &remote_refspecs, |
| 165 | &term, | 165 | &term, |
| 166 | is_ngit_relay(&git_server_url, &repo_ref.ngit_relays()), | 166 | is_grasp_server(&git_server_url, &repo_ref.grasp_servers()), |
| 167 | ); | 167 | ); |
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| @@ -429,11 +429,11 @@ fn push_to_remote( | |||
| 429 | decoded_nostr_url: &NostrUrlDecoded, | 429 | decoded_nostr_url: &NostrUrlDecoded, |
| 430 | remote_refspecs: &[String], | 430 | remote_refspecs: &[String], |
| 431 | term: &Term, | 431 | term: &Term, |
| 432 | is_ngit_relay: bool, | 432 | is_grasp_server: bool, |
| 433 | ) -> Result<()> { | 433 | ) -> Result<()> { |
| 434 | let server_url = git_server_url.parse::<CloneUrl>()?; | 434 | let server_url = git_server_url.parse::<CloneUrl>()?; |
| 435 | let protocols_to_attempt = | 435 | let protocols_to_attempt = |
| 436 | get_write_protocols_to_try(git_repo, &server_url, decoded_nostr_url, is_ngit_relay); | 436 | get_write_protocols_to_try(git_repo, &server_url, decoded_nostr_url, is_grasp_server); |
| 437 | 437 | ||
| 438 | let mut failed_protocols = vec![]; | 438 | let mut failed_protocols = vec![]; |
| 439 | let mut success = false; | 439 | let mut success = false; |
| @@ -726,8 +726,8 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 726 | 726 | ||
| 727 | let mut rejected_refspecs: HashMapUrlRefspecs = HashMap::new(); | 727 | let mut rejected_refspecs: HashMapUrlRefspecs = HashMap::new(); |
| 728 | 728 | ||
| 729 | for (url, (remote_state, is_ngit_relay)) in list_outputs { | 729 | for (url, (remote_state, is_grasp_server)) in list_outputs { |
| 730 | let is_ngit_relay = is_ngit_relay.to_owned(); | 730 | let is_grasp_server = is_grasp_server.to_owned(); |
| 731 | let short_name = get_short_git_server_name(git_repo, url); | 731 | let short_name = get_short_git_server_name(git_repo, url); |
| 732 | let mut refspecs_for_remote = vec![]; | 732 | let mut refspecs_for_remote = vec![]; |
| 733 | for refspec in refspecs { | 733 | for refspec in refspecs { |
| @@ -788,7 +788,7 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 788 | if ahead_of_nostr.is_empty() { | 788 | if ahead_of_nostr.is_empty() { |
| 789 | // ancestor of nostr and we are force pushing anyway... | 789 | // ancestor of nostr and we are force pushing anyway... |
| 790 | refspecs_for_remote.push(refspec.clone()); | 790 | refspecs_for_remote.push(refspec.clone()); |
| 791 | } else if is_ngit_relay { | 791 | } else if is_grasp_server { |
| 792 | // a grasp server can only be pushed to via nostr so can force push | 792 | // a grasp server can only be pushed to via nostr so can force push |
| 793 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); | 793 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); |
| 794 | } else { | 794 | } else { |
| @@ -807,7 +807,7 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 807 | )?; | 807 | )?; |
| 808 | } | 808 | } |
| 809 | } | 809 | } |
| 810 | } else if is_ngit_relay { | 810 | } else if is_grasp_server { |
| 811 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); | 811 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); |
| 812 | } else { | 812 | } else { |
| 813 | // remote_value oid is not present locally | 813 | // remote_value oid is not present locally |
| @@ -842,7 +842,7 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 842 | if ahead.is_empty() { | 842 | if ahead.is_empty() { |
| 843 | // can soft push | 843 | // can soft push |
| 844 | refspecs_for_remote.push(refspec.clone()); | 844 | refspecs_for_remote.push(refspec.clone()); |
| 845 | } else if is_ngit_relay { | 845 | } else if is_grasp_server { |
| 846 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); | 846 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); |
| 847 | } else { | 847 | } else { |
| 848 | // cant soft push | 848 | // cant soft push |
| @@ -858,7 +858,7 @@ fn create_rejected_refspecs_and_remotes_refspecs( | |||
| 858 | ).as_str(), | 858 | ).as_str(), |
| 859 | )?; | 859 | )?; |
| 860 | } | 860 | } |
| 861 | } else if is_ngit_relay { | 861 | } else if is_grasp_server { |
| 862 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); | 862 | refspecs_for_remote.push(ensure_force_push_refspec(refspec)); |
| 863 | } else { | 863 | } else { |
| 864 | // havn't fetched oid from remote | 864 | // havn't fetched oid from remote |