upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/git_remote_nostr/main.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-12-03 15:29:06 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-12-03 15:29:06 +0000
commitd2478dbca6c5d3f61331ceabe20c6d9315cd6840 (patch)
tree9cd79f52ac96378ef68b4798db48ee65839d9f74 /src/bin/git_remote_nostr/main.rs
parent79f55ad6488ddb628438580acf54a1d23a990cb3 (diff)
refactor: limit fetch to 1 trusted coordinate
previously fetch supported fetching multiple trusted coordinates at once. The additional complexity trade off isn't worth it. It will still fetch events related to the coordinates of maintainers that the trusted maintainer lists. A scenario where there might be multiple trusted coordinates is where a large repo is split into multiple nostr repos to manage pull requests and issues in seperate sub-units. I might therefore have different remotes that target different identifiers. There also might be different set of maintainers groups that are have different views on the latest state of the same codebase and they haven't split off into using different identifiers. Its simplier ngit to fetch these different nostr repos independantly when requested. git-remote-nostr will do this automatically as it works through remotes but for ngit cmds a further change is required so `get_repo_coordinates` and `try_and_get_repo_coordinates` prompts to select the desired one.
Diffstat (limited to 'src/bin/git_remote_nostr/main.rs')
-rw-r--r--src/bin/git_remote_nostr/main.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs
index 54fb7cf..8e12d68 100644
--- a/src/bin/git_remote_nostr/main.rs
+++ b/src/bin/git_remote_nostr/main.rs
@@ -43,10 +43,10 @@ async fn main() -> Result<()> {
43 client.set_signer(signer).await; 43 client.set_signer(signer).await;
44 } 44 }
45 45
46 fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinates).await?; 46 fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinate).await?;
47 47
48 let repo_ref = 48 let repo_ref =
49 get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinates).await?; 49 get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinate).await?;
50 50
51 let stdin = io::stdin(); 51 let stdin = io::stdin();
52 let mut line = String::new(); 52 let mut line = String::new();
@@ -148,12 +148,16 @@ fn process_args() -> Result<Option<(NostrUrlDecoded, Repo)>> {
148async fn fetching_with_report_for_helper( 148async fn fetching_with_report_for_helper(
149 git_repo_path: &Path, 149 git_repo_path: &Path,
150 client: &Client, 150 client: &Client,
151 repo_coordinates: &HashSet<Coordinate>, 151 trusted_maintainer_coordinate: &Coordinate,
152) -> Result<()> { 152) -> Result<()> {
153 let term = console::Term::stderr(); 153 let term = console::Term::stderr();
154 term.write_line("nostr: fetching...")?; 154 term.write_line("nostr: fetching...")?;
155 let (relay_reports, progress_reporter) = client 155 let (relay_reports, progress_reporter) = client
156 .fetch_all(Some(git_repo_path), repo_coordinates, &HashSet::new()) 156 .fetch_all(
157 Some(git_repo_path),
158 Some(trusted_maintainer_coordinate),
159 &HashSet::new(),
160 )
157 .await?; 161 .await?;
158 if !relay_reports.iter().any(std::result::Result::is_err) { 162 if !relay_reports.iter().any(std::result::Result::is_err) {
159 let _ = progress_reporter.clear(); 163 let _ = progress_reporter.clear();