summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-03-28 14:59:24 +0000
committerNick Thomas <nick@gitlab.com>2019-04-05 18:26:53 +0100
commite46d4bf4da3ee207043c85524df238475e47d650 (patch)
tree1ec85490dbabf747698eb253353372bb27533726 /app/models
parent9e0302cca79b40ed118d1334be7e9abf00c432eb (diff)
downloadgitlab-ce-e46d4bf4da3ee207043c85524df238475e47d650.tar.gz
Extract a Git::{Base,Tag,Branch}HooksService
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gpg_signature.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/gpg_signature.rb b/app/models/gpg_signature.rb
index 7f9ff7bbda6..46cac1d41bb 100644
--- a/app/models/gpg_signature.rb
+++ b/app/models/gpg_signature.rb
@@ -38,6 +38,15 @@ class GpgSignature < ApplicationRecord
.safe_find_or_create_by!(commit_sha: attributes[:commit_sha])
end
+ # Find commits that are lacking a signature in the database at present
+ def self.unsigned_commit_shas(commit_shas)
+ return [] if commit_shas.empty?
+
+ signed = GpgSignature.where(commit_sha: commit_shas).pluck(:commit_sha)
+
+ commit_shas - signed
+ end
+
def gpg_key=(model)
case model
when GpgKey