From b404cfa7b622297b30ec509dde2aa4b14a4beac3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 15 Aug 2025 12:39:01 +0100 Subject: fix: inaccessable PR commits breaks `git clone` we cannot list PRs under refs/heads/pr/* unless we are sure the oids are accessable on a git server as it will cause `git clone` to fail. we now only list PRs that are on accessable repo git servers under refs/heads/pr/*. we should be able to list them under under refs/pr/* as the clone command only fetches refs in refs/heads so we will do this seperately. --- src/bin/git_remote_nostr/list.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index df98c12..3159e0a 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs @@ -166,7 +166,18 @@ async fn get_open_and_draft_proposals_state( { match tag_value(pr_or_pr_update, "c") { Ok(tip) => { - state.insert(format!("refs/heads/{branch_name}"), tip); + // only list Pull Requests as refs/heads/pr/* if data is on a repo git + // server otherwise the standard `git clone + // nostr://` cmd will fail as it assumes all /refs/heads returned by + // list are accessable + let tip_oid_is_on_a_repo_git_server = + remote_states.iter().any(|(_url, (state, _is_grasp))| { + state.iter().any(|(_, oid)| tip == *oid) + }); + + if tip_oid_is_on_a_repo_git_server { + state.insert(format!("refs/heads/{branch_name}"), tip); + } } Err(_) => { let _ = term.write_line( -- cgit v1.2.3