diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-06 10:45:21 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-06 11:05:11 +0100 |
| commit | 6e7e7bd3497d2a77fda34e27f65955b8ac09b3be (patch) | |
| tree | 7d36f9feb568e63823e017b85d5a84443b1bb20c /src/bin/git_remote_nostr/push.rs | |
| parent | 935bc0ca630d7964082966e4c0caeb255f5a4f57 (diff) | |
fix(remote): `list` apply protocols selection
used in fetch and tweak the error reporting
Diffstat (limited to 'src/bin/git_remote_nostr/push.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 441c341..2c9c7e1 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -15,7 +15,7 @@ use git_events::{ | |||
| 15 | }; | 15 | }; |
| 16 | use ngit::{ | 16 | use ngit::{ |
| 17 | client::{self, get_event_from_cache_by_id}, | 17 | client::{self, get_event_from_cache_by_id}, |
| 18 | git, | 18 | git::{self, nostr_url::NostrUrlDecoded}, |
| 19 | git_events::{self, get_event_root}, | 19 | git_events::{self, get_event_root}, |
| 20 | login::{self, get_curent_user}, | 20 | login::{self, get_curent_user}, |
| 21 | repo_ref, repo_state, | 21 | repo_ref, repo_state, |
| @@ -42,7 +42,7 @@ use crate::{ | |||
| 42 | pub async fn run_push( | 42 | pub async fn run_push( |
| 43 | git_repo: &Repo, | 43 | git_repo: &Repo, |
| 44 | repo_ref: &RepoRef, | 44 | repo_ref: &RepoRef, |
| 45 | nostr_remote_url: &str, | 45 | decoded_nostr_url: &NostrUrlDecoded, |
| 46 | stdin: &Stdin, | 46 | stdin: &Stdin, |
| 47 | initial_refspec: &str, | 47 | initial_refspec: &str, |
| 48 | client: &Client, | 48 | client: &Client, |
| @@ -66,7 +66,7 @@ pub async fn run_push( | |||
| 66 | 66 | ||
| 67 | let list_outputs = match list_outputs { | 67 | let list_outputs = match list_outputs { |
| 68 | Some(outputs) => outputs, | 68 | Some(outputs) => outputs, |
| 69 | _ => list_from_remotes(&term, git_repo, &repo_ref.git_server)?, | 69 | _ => list_from_remotes(&term, git_repo, &repo_ref.git_server, decoded_nostr_url), |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | let nostr_state = get_state_from_cache(git_repo.get_path()?, repo_ref).await; | 72 | let nostr_state = get_state_from_cache(git_repo.get_path()?, repo_ref).await; |
| @@ -154,7 +154,7 @@ pub async fn run_push( | |||
| 154 | &term, | 154 | &term, |
| 155 | repo_ref, | 155 | repo_ref, |
| 156 | git_repo, | 156 | git_repo, |
| 157 | nostr_remote_url, | 157 | &decoded_nostr_url.original_string, |
| 158 | &signer, | 158 | &signer, |
| 159 | &git_server_refspecs, | 159 | &git_server_refspecs, |
| 160 | ) | 160 | ) |
| @@ -306,8 +306,12 @@ pub async fn run_push( | |||
| 306 | } | 306 | } |
| 307 | let (_, to) = refspec_to_from_to(refspec)?; | 307 | let (_, to) = refspec_to_from_to(refspec)?; |
| 308 | println!("ok {to}"); | 308 | println!("ok {to}"); |
| 309 | update_remote_refs_pushed(&git_repo.git_repo, refspec, nostr_remote_url) | 309 | update_remote_refs_pushed( |
| 310 | .context("could not update remote_ref locally")?; | 310 | &git_repo.git_repo, |
| 311 | refspec, | ||
| 312 | &decoded_nostr_url.original_string, | ||
| 313 | ) | ||
| 314 | .context("could not update remote_ref locally")?; | ||
| 311 | } | 315 | } |
| 312 | 316 | ||
| 313 | // TODO make async - check gitlib2 callbacks work async | 317 | // TODO make async - check gitlib2 callbacks work async |