diff options
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/list.rs | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index af340fe..1ba6163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
| @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 7 | 7 | ||
| 8 | ## [Unreleased] | 8 | ## [Unreleased] |
| 9 | 9 | ||
| 10 | ### Fixed | ||
| 11 | |||
| 12 | - when a repo has multiple `nostr://` remotes sharing the same identifier, relays could return state events authored by maintainers of the *other* remote; without filtering, the newest event won regardless of author, pointing refs at the wrong commits; state event candidates in `run_list` are now filtered to maintainers of the current remote's repo announcement | ||
| 13 | |||
| 10 | ## [2.4.2] - 2026-04-28 | 14 | ## [2.4.2] - 2026-04-28 |
| 11 | 15 | ||
| 12 | ### Fixed | 16 | ### Fixed |
diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index 23b3b98..a17090e 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs | |||
| @@ -58,10 +58,14 @@ pub async fn run_list( | |||
| 58 | // (b) already available locally. | 58 | // (b) already available locally. |
| 59 | // This prevents advertising refs whose git objects haven't been pushed to | 59 | // This prevents advertising refs whose git objects haven't been pushed to |
| 60 | // any server yet, which would cause `git clone` / `git fetch` to fail. | 60 | // any server yet, which would cause `git clone` / `git fetch` to fail. |
| 61 | // | ||
| 62 | // filter by maintainers to avoid state events from other remotes with the | ||
| 63 | // same identifier being selected when they have a newer created_at | ||
| 61 | let mut candidates: Vec<&nostr::Event> = fetch_report | 64 | let mut candidates: Vec<&nostr::Event> = fetch_report |
| 62 | .state_per_relay | 65 | .state_per_relay |
| 63 | .values() | 66 | .values() |
| 64 | .filter_map(|maybe| maybe.as_ref()) | 67 | .filter_map(|maybe| maybe.as_ref()) |
| 68 | .filter(|event| repo_ref.maintainers.contains(&event.pubkey)) | ||
| 65 | .collect(); | 69 | .collect(); |
| 66 | // Sort newest-first (by created_at, then by id for tie-breaking). | 70 | // Sort newest-first (by created_at, then by id for tie-breaking). |
| 67 | candidates.sort_by(|a, b| { | 71 | candidates.sort_by(|a, b| { |