From d2478dbca6c5d3f61331ceabe20c6d9315cd6840 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 3 Dec 2024 15:29:06 +0000 Subject: 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. --- src/bin/git_remote_nostr/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/bin/git_remote_nostr') 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<()> { client.set_signer(signer).await; } - fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinates).await?; + fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinate).await?; let repo_ref = - get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinates).await?; + get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinate).await?; let stdin = io::stdin(); let mut line = String::new(); @@ -148,12 +148,16 @@ fn process_args() -> Result> { async fn fetching_with_report_for_helper( git_repo_path: &Path, client: &Client, - repo_coordinates: &HashSet, + trusted_maintainer_coordinate: &Coordinate, ) -> Result<()> { let term = console::Term::stderr(); term.write_line("nostr: fetching...")?; let (relay_reports, progress_reporter) = client - .fetch_all(Some(git_repo_path), repo_coordinates, &HashSet::new()) + .fetch_all( + Some(git_repo_path), + Some(trusted_maintainer_coordinate), + &HashSet::new(), + ) .await?; if !relay_reports.iter().any(std::result::Result::is_err) { let _ = progress_reporter.clear(); -- cgit v1.2.3