upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/lib/git_events.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-07-18 17:33:11 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-07-18 17:33:11 +0100
commita3d4c8eaa263f4adb174ac81c4248fa200e1857e (patch)
tree0b786013c3b3da67123e2ff02f95b7c41eb8dfc0 /src/lib/git_events.rs
parent3eb2354edb8e76428625d5645e110c30aa1ccc2a (diff)
feat(pr): fetch pr and pr updates from clone urls
we try and get them from clone urls of repo and fallback to those specified by contributor
Diffstat (limited to 'src/lib/git_events.rs')
-rw-r--r--src/lib/git_events.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 7b25daf..09ec040 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -90,6 +90,19 @@ pub fn patch_supports_commit_ids(event: &Event) -> bool {
90 .any(|t| !t.as_slice().is_empty() && t.as_slice()[0].eq("commit-pgp-sig")) 90 .any(|t| !t.as_slice().is_empty() && t.as_slice()[0].eq("commit-pgp-sig"))
91} 91}
92 92
93pub fn event_is_valid_pr_or_pr_update(event: &Event) -> bool {
94 [KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE].contains(&event.kind)
95 && event.tags.iter().any(|t| {
96 t.as_slice().len().gt(&1)
97 && t.as_slice()[0].eq("c")
98 && git2::Oid::from_str(&t.as_slice()[1]).is_ok()
99 })
100 && event
101 .tags
102 .iter()
103 .any(|t| t.as_slice().len().gt(&1) && t.as_slice()[0].eq("clone"))
104}
105
93#[allow(clippy::too_many_arguments)] 106#[allow(clippy::too_many_arguments)]
94#[allow(clippy::too_many_lines)] 107#[allow(clippy::too_many_lines)]
95pub async fn generate_patch_event( 108pub async fn generate_patch_event(