upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/git_remote_nostr/fetch.rs20
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};
21use nostr::nips::nip19;
22use nostr_sdk::ToBech32;
21 23
22use crate::utils::{ 24use 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(