diff options
Diffstat (limited to 'src/lib/git_events.rs')
| -rw-r--r-- | src/lib/git_events.rs | 13 |
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 | ||
| 93 | pub 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)] |
| 95 | pub async fn generate_patch_event( | 108 | pub async fn generate_patch_event( |