upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/nostr
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-26 15:38:51 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-26 15:38:51 +0000
commita2ecfc5a63311570f0f90c7ee40117e289639cb8 (patch)
tree0c5208cb7d606be4b431cda813b09dcc64a50e23 /src/nostr
parentb13c6d924f7de5ff34405254b8bb21adf33c78c0 (diff)
fix: ignore peeled tag entries (^{}) in state event ref parsing
State events (kind 30618) can include refs/tags/<name>^{} entries which are git's notation for the dereferenced commit behind an annotated tag. These are not real git refs and are never sent as part of a push. extract_refs_from_state and RepositoryState::from_event were treating them as real refs, causing can_satisfy_state to reject valid annotated tag pushes: the would-be state after the push lacked the spurious ^{} entry, so the exact-equality check always failed.
Diffstat (limited to 'src/nostr')
-rw-r--r--src/nostr/events.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nostr/events.rs b/src/nostr/events.rs
index a441742..00e4486 100644
--- a/src/nostr/events.rs
+++ b/src/nostr/events.rs
@@ -260,12 +260,14 @@ impl RepositoryState {
260 260
261 // Extract tags (refs/tags/*) 261 // Extract tags (refs/tags/*)
262 // Tag format: ["refs/tags/v1.0", "commit_hash"] 262 // Tag format: ["refs/tags/v1.0", "commit_hash"]
263 // Exclude peeled tag notation ("refs/tags/v1.0^{}") — these are git's internal
264 // dereference markers pointing to the underlying commit, not real refs.
263 let tags = event 265 let tags = event
264 .tags 266 .tags
265 .iter() 267 .iter()
266 .filter_map(|t| { 268 .filter_map(|t| {
267 if let TagKind::Custom(s) = t.kind() { 269 if let TagKind::Custom(s) = t.kind() {
268 if s.as_ref().starts_with("refs/tags/") { 270 if s.as_ref().starts_with("refs/tags/") && !s.as_ref().ends_with("^{}") {
269 let parts = t.clone().to_vec(); 271 let parts = t.clone().to_vec();
270 if parts.len() >= 2 { 272 if parts.len() >= 2 {
271 Some(TagState { 273 Some(TagState {