summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2018-07-30 16:55:28 +0000
committerNick Thomas <nick@gitlab.com>2018-07-30 16:55:28 +0000
commit9a81550feddd907f8796362d604f63ed66ad80a2 (patch)
tree90d9c1deae0ee2c57b05fbe76ed96d13cf54a1af /app/services
parent5b6553a0810f65d79c648aca9dba254644a293fb (diff)
downloadgitlab-ce-9a81550feddd907f8796362d604f63ed66ad80a2.tar.gz
Create GPG commit signature in bulk
Diffstat (limited to 'app/services')
-rw-r--r--app/services/git_push_service.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 29c8ce5fea3..f0587667d37 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -76,7 +76,7 @@ class GitPushService < BaseService
else
paths = Set.new
- @push_commits.last(PROCESS_COMMIT_LIMIT).each do |commit|
+ last_pushed_commits.each do |commit|
commit.raw_deltas.each do |diff|
paths << diff.new_path
end
@@ -92,7 +92,7 @@ class GitPushService < BaseService
end
def update_signatures
- commit_shas = @push_commits.last(PROCESS_COMMIT_LIMIT).map(&:sha)
+ commit_shas = last_pushed_commits.map(&:sha)
return if commit_shas.empty?
@@ -103,16 +103,14 @@ class GitPushService < BaseService
commit_shas = Gitlab::Git::Commit.shas_with_signatures(project.repository, commit_shas)
- commit_shas.each do |sha|
- CreateGpgSignatureWorker.perform_async(sha, project.id)
- end
+ CreateGpgSignatureWorker.perform_async(commit_shas, project.id)
end
# Schedules processing of commit messages.
def process_commit_messages
default = default_branch?
- @push_commits.last(PROCESS_COMMIT_LIMIT).each do |commit|
+ last_pushed_commits.each do |commit|
if commit.matches_cross_reference_regex?
ProcessCommitWorker
.perform_async(project.id, current_user.id, commit.to_hash, default)
@@ -206,4 +204,8 @@ class GitPushService < BaseService
def branch_name
@branch_name ||= Gitlab::Git.ref_name(params[:ref])
end
+
+ def last_pushed_commits
+ @last_pushed_commits ||= @push_commits.last(PROCESS_COMMIT_LIMIT)
+ end
end