upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/git_remote_nostr/push.rs11
-rw-r--r--src/bin/ngit/sub_commands/init.rs15
2 files changed, 14 insertions, 12 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index db86c04..c57e21f 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -29,9 +29,8 @@ use ngit::{
29}; 29};
30use nostr::nips::nip10::Marker; 30use nostr::nips::nip10::Marker;
31use nostr_sdk::{ 31use nostr_sdk::{
32 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, Kind, PublicKey, Tag, 32 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, Tag,
33}; 33};
34use nostr_signer::NostrSigner;
35use repo_ref::RepoRef; 34use repo_ref::RepoRef;
36use repo_state::RepoState; 35use repo_state::RepoState;
37 36
@@ -868,7 +867,7 @@ async fn get_merged_status_events(
868 repo_ref: &RepoRef, 867 repo_ref: &RepoRef,
869 git_repo: &Repo, 868 git_repo: &Repo,
870 remote_nostr_url: &str, 869 remote_nostr_url: &str,
871 signer: &NostrSigner, 870 signer: &Arc<dyn NostrSigner>,
872 refspecs_to_git_server: &Vec<String>, 871 refspecs_to_git_server: &Vec<String>,
873) -> Result<Vec<Event>> { 872) -> Result<Vec<Event>> {
874 let mut events = vec![]; 873 let mut events = vec![];
@@ -944,7 +943,7 @@ async fn get_merged_status_events(
944} 943}
945 944
946async fn create_merge_status( 945async fn create_merge_status(
947 signer: &NostrSigner, 946 signer: &Arc<dyn NostrSigner>,
948 repo_ref: &RepoRef, 947 repo_ref: &RepoRef,
949 proposal: &Event, 948 proposal: &Event,
950 revision: &Option<Event>, 949 revision: &Option<Event>,
@@ -1186,14 +1185,14 @@ trait BuildRepoState {
1186 async fn build( 1185 async fn build(
1187 identifier: String, 1186 identifier: String,
1188 state: HashMap<String, String>, 1187 state: HashMap<String, String>,
1189 signer: &NostrSigner, 1188 signer: &Arc<dyn NostrSigner>,
1190 ) -> Result<RepoState>; 1189 ) -> Result<RepoState>;
1191} 1190}
1192impl BuildRepoState for RepoState { 1191impl BuildRepoState for RepoState {
1193 async fn build( 1192 async fn build(
1194 identifier: String, 1193 identifier: String,
1195 state: HashMap<String, String>, 1194 state: HashMap<String, String>,
1196 signer: &NostrSigner, 1195 signer: &Arc<dyn NostrSigner>,
1197 ) -> Result<RepoState> { 1196 ) -> Result<RepoState> {
1198 let mut tags = vec![Tag::identifier(identifier.clone())]; 1197 let mut tags = vec![Tag::identifier(identifier.clone())];
1199 for (name, value) in &state { 1198 for (name, value) in &state {
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 8f9ff0d..50b8b3c 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -212,7 +212,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
212 let mut maintainers_string = if !args.other_maintainers.is_empty() { 212 let mut maintainers_string = if !args.other_maintainers.is_empty() {
213 [args.other_maintainers.clone()].concat().join(" ") 213 [args.other_maintainers.clone()].concat().join(" ")
214 } else if repo_ref.is_none() && repo_config_result.is_err() { 214 } else if repo_ref.is_none() && repo_config_result.is_err() {
215 signer.public_key().await?.to_bech32()? 215 signer.get_public_key().await?.to_bech32()?
216 } else { 216 } else {
217 let maintainers = if let Ok(config) = &repo_config_result { 217 let maintainers = if let Ok(config) = &repo_config_result {
218 config.maintainers.clone() 218 config.maintainers.clone()
@@ -225,7 +225,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
225 .collect() 225 .collect()
226 } else { 226 } else {
227 //unreachable 227 //unreachable
228 vec![signer.public_key().await?.to_bech32()?] 228 vec![signer.get_public_key().await?.to_bech32()?]
229 }; 229 };
230 // add current user if not present 230 // add current user if not present
231 if maintainers.iter().any(|m| { 231 if maintainers.iter().any(|m| {
@@ -237,9 +237,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
237 }) { 237 }) {
238 maintainers.join(" ") 238 maintainers.join(" ")
239 } else { 239 } else {
240 [maintainers, vec![signer.public_key().await?.to_bech32()?]] 240 [
241 .concat() 241 maintainers,
242 .join(" ") 242 vec![signer.get_public_key().await?.to_bech32()?],
243 ]
244 .concat()
245 .join(" ")
243 } 246 }
244 }; 247 };
245 'outer: loop { 248 'outer: loop {
@@ -263,7 +266,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
263 } 266 }
264 // add current user incase removed 267 // add current user incase removed
265 if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) { 268 if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) {
266 maintainers.push(signer.public_key().await?); 269 maintainers.push(signer.get_public_key().await?);
267 } 270 }
268 break maintainers; 271 break maintainers;
269 } 272 }