clean up
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s

This commit is contained in:
2026-10-03 16:38:25 +07:00
parent a56b0b8881
commit f12feeb196
4 changed files with 9 additions and 296 deletions
+3 -15
View File
@@ -47,19 +47,10 @@ impl RepoStatus {
}
}
// NIP-10 and NIP-34 use the lowercase `e` tag; NIP-22 comments, kind `1111`,
// use the uppercase `E` tag for the thread root.
pub fn references_root(event: &Event, root: &EventId) -> bool {
let root = root.to_hex();
event
.tags
.iter()
.any(|tag| matches!(tag.kind(), "e" | "E") && tag.content() == Some(root.as_str()))
}
#[cfg(test)]
mod tests {
use super::*;
use crate::GitEvent;
const ROOT_ID_HEX: &str = "1111111111111111111111111111111111111111111111111111111111111111";
const OTHER_ID_HEX: &str = "2222222222222222222222222222222222222222222222222222222222222222";
@@ -90,11 +81,8 @@ mod tests {
))
.expect("signed event");
assert!(references_root(&event, &root));
assert!(!references_root(
&event,
&EventId::from_hex(OTHER_ID_HEX).expect("valid id")
));
assert!(event.references_root(&root));
assert!(!event.references_root(&EventId::from_hex(OTHER_ID_HEX).expect("valid id")));
}
#[test]