diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-18 12:13:26 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-18 12:13:26 +0100 |
| commit | e91f95f0d4577d64e41e3ac1d7ae87035a5f12e0 (patch) | |
| tree | f02b5bdcee4a0023cd39e719eb8e47728f5d142d /src/bin/git_remote_nostr | |
| parent | a3af3f1b9fa5c1af5ecf54d03907ae23e8b238ee (diff) | |
fix(remote): create pr commit error reporting
so it clear which patch is causing issues and it continues to report
the fetch problem to the git client.
we need a better solution it degrades gracefully rather than
stopping the operation.
perhaps list needs to only list PRs which it can create from existing
data objects?
perhaps list also needs fetch objects before fetch is called?
Diffstat (limited to 'src/bin/git_remote_nostr')
| -rw-r--r-- | src/bin/git_remote_nostr/fetch.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs index 5dd6ce8..2e16297 100644 --- a/src/bin/git_remote_nostr/fetch.rs +++ b/src/bin/git_remote_nostr/fetch.rs | |||
| @@ -18,6 +18,8 @@ use ngit::{ | |||
| 18 | login::get_curent_user, | 18 | login::get_curent_user, |
| 19 | repo_ref::RepoRef, | 19 | repo_ref::RepoRef, |
| 20 | }; | 20 | }; |
| 21 | use nostr::nips::nip19; | ||
| 22 | use nostr_sdk::ToBech32; | ||
| 21 | 23 | ||
| 22 | use crate::utils::{ | 24 | use crate::utils::{ |
| 23 | count_lines_per_msg_vec, fetch_or_list_error_is_not_authentication_failure, | 25 | count_lines_per_msg_vec, fetch_or_list_error_is_not_authentication_failure, |
| @@ -93,7 +95,23 @@ pub async fn run_fetch( | |||
| 93 | "parent-commit", | 95 | "parent-commit", |
| 94 | )?)? { | 96 | )?)? { |
| 95 | for patch in &patches_ancestor_first { | 97 | for patch in &patches_ancestor_first { |
| 96 | git_repo.create_commit_from_patch(patch)?; | 98 | if let Err(error) = git_repo.create_commit_from_patch(patch) { |
| 99 | term.write_line( | ||
| 100 | format!( | ||
| 101 | "WARNING: cannot create branch for {refstr}, error: {error} for patch {}", | ||
| 102 | nip19::Nip19Event { | ||
| 103 | event_id: patch.id(), | ||
| 104 | author: Some(patch.author()), | ||
| 105 | kind: Some(patch.kind()), | ||
| 106 | relays: if let Some(relay) = repo_ref.relays.first() { | ||
| 107 | vec![relay.to_string()] | ||
| 108 | } else { vec![]}, | ||
| 109 | }.to_bech32().unwrap_or_default() | ||
| 110 | ) | ||
| 111 | .as_str(), | ||
| 112 | )?; | ||
| 113 | break; | ||
| 114 | } | ||
| 97 | } | 115 | } |
| 98 | } else { | 116 | } else { |
| 99 | term.write_line( | 117 | term.write_line( |