upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-12-16 07:58:54 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-12-16 08:55:50 +0000
commit5fe839e2bf8ceb2931c1984efb2d956980431203 (patch)
treeb8091597db6999ec2de65ac2dd091611a37354ba
parent40463a9073df4033622066bd0c548e1549e0a953 (diff)
chore: nix flake update
update nix dependancies to latest version using default update options fix warning related to idomatic patterns
-rw-r--r--flake.lock24
-rw-r--r--src/bin/git_remote_nostr/fetch.rs17
-rw-r--r--src/bin/git_remote_nostr/push.rs13
-rw-r--r--src/bin/git_remote_nostr/utils.rs2
-rw-r--r--src/bin/ngit/sub_commands/init.rs53
-rw-r--r--src/lib/git_events.rs4
6 files changed, 59 insertions, 54 deletions
diff --git a/flake.lock b/flake.lock
index 94315c0..a01b7d4 100644
--- a/flake.lock
+++ b/flake.lock
@@ -5,11 +5,11 @@
5 "systems": "systems" 5 "systems": "systems"
6 }, 6 },
7 "locked": { 7 "locked": {
8 "lastModified": 1726560853, 8 "lastModified": 1731533236,
9 "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", 9 "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
10 "owner": "numtide", 10 "owner": "numtide",
11 "repo": "flake-utils", 11 "repo": "flake-utils",
12 "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", 12 "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
13 "type": "github" 13 "type": "github"
14 }, 14 },
15 "original": { 15 "original": {
@@ -20,11 +20,11 @@
20 }, 20 },
21 "nixpkgs": { 21 "nixpkgs": {
22 "locked": { 22 "locked": {
23 "lastModified": 1726463316, 23 "lastModified": 1734119587,
24 "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", 24 "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
25 "owner": "NixOS", 25 "owner": "NixOS",
26 "repo": "nixpkgs", 26 "repo": "nixpkgs",
27 "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", 27 "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
28 "type": "github" 28 "type": "github"
29 }, 29 },
30 "original": { 30 "original": {
@@ -36,11 +36,11 @@
36 }, 36 },
37 "nixpkgs_2": { 37 "nixpkgs_2": {
38 "locked": { 38 "locked": {
39 "lastModified": 1718428119, 39 "lastModified": 1728538411,
40 "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", 40 "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
41 "owner": "NixOS", 41 "owner": "NixOS",
42 "repo": "nixpkgs", 42 "repo": "nixpkgs",
43 "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", 43 "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
44 "type": "github" 44 "type": "github"
45 }, 45 },
46 "original": { 46 "original": {
@@ -62,11 +62,11 @@
62 "nixpkgs": "nixpkgs_2" 62 "nixpkgs": "nixpkgs_2"
63 }, 63 },
64 "locked": { 64 "locked": {
65 "lastModified": 1726626348, 65 "lastModified": 1734316514,
66 "narHash": "sha256-sYV7e1B1yLcxo8/h+/hTwzZYmaju2oObNiy5iRI0C30=", 66 "narHash": "sha256-0aLx44yMblcOGpfFXKCzp2GhU5JaE6OTvdU+JYrXiUc=",
67 "owner": "oxalica", 67 "owner": "oxalica",
68 "repo": "rust-overlay", 68 "repo": "rust-overlay",
69 "rev": "6fd52ad8bd88f39efb2c999cc971921c2fb9f3a2", 69 "rev": "83ee8ff74d6294a7657320f16814754c4594127b",
70 "type": "github" 70 "type": "github"
71 }, 71 },
72 "original": { 72 "original": {
diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs
index 90387f3..458c6d8 100644
--- a/src/bin/git_remote_nostr/fetch.rs
+++ b/src/bin/git_remote_nostr/fetch.rs
@@ -141,9 +141,11 @@ async fn fetch_proposals(
141 let current_user = get_curent_user(git_repo)?; 141 let current_user = get_curent_user(git_repo)?;
142 142
143 for refstr in proposal_refs.keys() { 143 for refstr in proposal_refs.keys() {
144 if let Some((_, (_, patches))) = 144 if let Some((_, (_, patches))) = find_proposal_and_patches_by_branch_name(
145 find_proposal_and_patches_by_branch_name(refstr, &open_proposals, &current_user) 145 refstr,
146 { 146 &open_proposals,
147 current_user.as_ref(),
148 ) {
147 if let Err(error) = make_commits_for_proposal(git_repo, repo_ref, patches) { 149 if let Err(error) = make_commits_for_proposal(git_repo, repo_ref, patches) {
148 term.write_line( 150 term.write_line(
149 format!("WARNING: failed to create branch for {refstr}, error: {error}",) 151 format!("WARNING: failed to create branch for {refstr}, error: {error}",)
@@ -234,7 +236,7 @@ pub fn fetch_from_git_server(
234fn report_on_transfer_progress( 236fn report_on_transfer_progress(
235 progress_stats: &Progress<'_>, 237 progress_stats: &Progress<'_>,
236 start_time: &Instant, 238 start_time: &Instant,
237 end_time: &Option<Instant>, 239 end_time: Option<&Instant>,
238) -> Vec<String> { 240) -> Vec<String> {
239 let mut report = vec![]; 241 let mut report = vec![];
240 let total = progress_stats.total_objects() as f64; 242 let total = progress_stats.total_objects() as f64;
@@ -378,8 +380,11 @@ impl<'a> FetchReporter<'a> {
378 self.start_time = Some(Instant::now()); 380 self.start_time = Some(Instant::now());
379 } 381 }
380 let existing_lines = self.just_count_transfer_progress(); 382 let existing_lines = self.just_count_transfer_progress();
381 let updated = 383 let updated = report_on_transfer_progress(
382 report_on_transfer_progress(progress_stats, &self.start_time.unwrap(), &self.end_time); 384 progress_stats,
385 &self.start_time.unwrap(),
386 self.end_time.as_ref(),
387 );
383 if self.transfer_progress_msgs.len() <= updated.len() { 388 if self.transfer_progress_msgs.len() <= updated.len() {
384 if self.end_time.is_none() && updated.first().is_some_and(|f| f.contains("100%")) { 389 if self.end_time.is_none() && updated.first().is_some_and(|f| f.contains("100%")) {
385 self.end_time = Some(Instant::now()); 390 self.end_time = Some(Instant::now());
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index 48122e3..f2ac169 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -299,7 +299,7 @@ async fn process_proposal_refspecs(
299 let tip_of_pushed_branch = git_repo.get_commit_or_tip_of_reference(from)?; 299 let tip_of_pushed_branch = git_repo.get_commit_or_tip_of_reference(from)?;
300 300
301 if let Some((_, (proposal, patches))) = 301 if let Some((_, (proposal, patches))) =
302 find_proposal_and_patches_by_branch_name(to, &all_proposals, &current_user) 302 find_proposal_and_patches_by_branch_name(to, &all_proposals, current_user.as_ref())
303 { 303 {
304 if [repo_ref.maintainers.clone(), vec![proposal.pubkey]] 304 if [repo_ref.maintainers.clone(), vec![proposal.pubkey]]
305 .concat() 305 .concat()
@@ -576,7 +576,7 @@ fn report_on_transfer_progress(
576 total: usize, 576 total: usize,
577 bytes: usize, 577 bytes: usize,
578 start_time: &Instant, 578 start_time: &Instant,
579 end_time: &Option<Instant>, 579 end_time: Option<&Instant>,
580) -> Option<String> { 580) -> Option<String> {
581 if total == 0 { 581 if total == 0 {
582 return None; 582 return None;
@@ -688,7 +688,7 @@ impl<'a> PushReporter<'a> {
688 total, 688 total,
689 bytes, 689 bytes,
690 &self.start_time.unwrap(), 690 &self.start_time.unwrap(),
691 &self.end_time, 691 self.end_time.as_ref(),
692 ) { 692 ) {
693 let existing_lines = self.count_all_existing_lines(); 693 let existing_lines = self.count_all_existing_lines();
694 if report.contains("100%") { 694 if report.contains("100%") {
@@ -1215,11 +1215,12 @@ async fn create_merge_events(
1215 signer, 1215 signer,
1216 repo_ref, 1216 repo_ref,
1217 &proposal, 1217 &proposal,
1218 &if let Some(revision_id) = revision_id { 1218 if let Some(revision_id) = revision_id {
1219 Some(get_event_from_cache_by_id(git_repo, revision_id).await?) 1219 Some(get_event_from_cache_by_id(git_repo, revision_id).await?)
1220 } else { 1220 } else {
1221 None 1221 None
1222 }, 1222 }
1223 .as_ref(),
1223 if let Some((commit, _)) = merged_patches 1224 if let Some((commit, _)) = merged_patches
1224 .iter() 1225 .iter()
1225 .find(|(_, m)| **m == MergedPRCommitType::MergeCommit) 1226 .find(|(_, m)| **m == MergedPRCommitType::MergeCommit)
@@ -1263,7 +1264,7 @@ async fn create_merge_status(
1263 signer: &Arc<dyn NostrSigner>, 1264 signer: &Arc<dyn NostrSigner>,
1264 repo_ref: &RepoRef, 1265 repo_ref: &RepoRef,
1265 proposal: &Event, 1266 proposal: &Event,
1266 revision: &Option<Event>, 1267 revision: Option<&Event>,
1267 merge_commits: Vec<Sha1Hash>, 1268 merge_commits: Vec<Sha1Hash>,
1268 merged_patches: Vec<EventId>, 1269 merged_patches: Vec<EventId>,
1269 applied: bool, 1270 applied: bool,
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs
index 5efb6e0..8e89652 100644
--- a/src/bin/git_remote_nostr/utils.rs
+++ b/src/bin/git_remote_nostr/utils.rs
@@ -188,7 +188,7 @@ pub async fn get_all_proposals(
188pub fn find_proposal_and_patches_by_branch_name<'a>( 188pub fn find_proposal_and_patches_by_branch_name<'a>(
189 refstr: &'a str, 189 refstr: &'a str,
190 open_proposals: &'a HashMap<EventId, (Event, Vec<Event>)>, 190 open_proposals: &'a HashMap<EventId, (Event, Vec<Event>)>,
191 current_user: &Option<PublicKey>, 191 current_user: Option<&PublicKey>,
192) -> Option<(&'a EventId, &'a (Event, Vec<Event>))> { 192) -> Option<(&'a EventId, &'a (Event, Vec<Event>))> {
193 open_proposals.iter().find(|(_, (proposal, _))| { 193 open_proposals.iter().find(|(_, (proposal, _))| {
194 is_event_proposal_root_for_branch(proposal, refstr, current_user).unwrap_or(false) 194 is_event_proposal_root_for_branch(proposal, refstr, current_user).unwrap_or(false)
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 1695e4c..0894f41 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -364,34 +364,33 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
364 args.web.clone() 364 args.web.clone()
365 }; 365 };
366 366
367 let earliest_unique_commit = match &args.earliest_unique_commit { 367 let earliest_unique_commit = if let Some(t) = &args.earliest_unique_commit {
368 Some(t) => t.clone(), 368 t.clone()
369 None => { 369 } else {
370 let mut earliest_unique_commit = if let Some(repo_ref) = &repo_ref { 370 let mut earliest_unique_commit = if let Some(repo_ref) = &repo_ref {
371 repo_ref.root_commit.clone() 371 repo_ref.root_commit.clone()
372 } else { 372 } else {
373 root_commit.to_string() 373 root_commit.to_string()
374 }; 374 };
375 println!( 375 println!(
376 "the earliest unique commit helps with discoverability. It defaults to the root commit. Only change this if your repo has completely forked off an has formed its own identity." 376 "the earliest unique commit helps with discoverability. It defaults to the root commit. Only change this if your repo has completely forked off an has formed its own identity."
377 ); 377 );
378 loop { 378 loop {
379 earliest_unique_commit = Interactor::default().input( 379 earliest_unique_commit = Interactor::default().input(
380 PromptInputParms::default() 380 PromptInputParms::default()
381 .with_prompt("earliest unique commit (to help with discoverability)") 381 .with_prompt("earliest unique commit (to help with discoverability)")
382 .with_default(earliest_unique_commit.clone()), 382 .with_default(earliest_unique_commit.clone()),
383 )?; 383 )?;
384 if let Ok(exists) = git_repo.does_commit_exist(&earliest_unique_commit) { 384 if let Ok(exists) = git_repo.does_commit_exist(&earliest_unique_commit) {
385 if exists { 385 if exists {
386 break earliest_unique_commit; 386 break earliest_unique_commit;
387 }
388 println!("commit does not exist on current repository");
389 } else {
390 println!("commit id not formatted correctly");
391 }
392 if earliest_unique_commit.len().ne(&40) {
393 println!("commit id must be 40 characters long");
394 } 387 }
388 println!("commit does not exist on current repository");
389 } else {
390 println!("commit id not formatted correctly");
391 }
392 if earliest_unique_commit.len().ne(&40) {
393 println!("commit id must be 40 characters long");
395 } 394 }
396 } 395 }
397 }; 396 };
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 17fae8c..d8564ae 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -619,11 +619,11 @@ fn get_event_parent_id(event: &nostr::Event) -> Result<String> {
619pub fn is_event_proposal_root_for_branch( 619pub fn is_event_proposal_root_for_branch(
620 e: &Event, 620 e: &Event,
621 branch_name_or_refstr: &str, 621 branch_name_or_refstr: &str,
622 logged_in_user: &Option<PublicKey>, 622 logged_in_user: Option<&PublicKey>,
623) -> Result<bool> { 623) -> Result<bool> {
624 let branch_name = branch_name_or_refstr.replace("refs/heads/", ""); 624 let branch_name = branch_name_or_refstr.replace("refs/heads/", "");
625 Ok(event_to_cover_letter(e).is_ok_and(|cl| { 625 Ok(event_to_cover_letter(e).is_ok_and(|cl| {
626 (logged_in_user.is_some_and(|public_key| e.pubkey.eq(&public_key)) 626 (logged_in_user.is_some_and(|public_key| e.pubkey.eq(public_key))
627 && (branch_name.eq(&format!("pr/{}", cl.branch_name)) 627 && (branch_name.eq(&format!("pr/{}", cl.branch_name))
628 || cl.branch_name.eq(&branch_name))) 628 || cl.branch_name.eq(&branch_name)))
629 || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name)) 629 || cl.get_branch_name().is_ok_and(|s| s.eq(&branch_name))