summaryrefslogtreecommitdiff
path: root/app/models/commit_collection.rb
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@gitlab.com>2019-02-06 12:33:11 +0000
committerNick Thomas <nick@gitlab.com>2019-02-06 12:33:11 +0000
commit2b7dd017af7de4d09ef3a1cd835e8d07c8800b6a (patch)
tree47615a573f6dc932353f0f6695cd4fcd050b1201 /app/models/commit_collection.rb
parent5bfa8e2f5e03849645570ba8c2dbfcc5c834f1b1 (diff)
downloadgitlab-ce-2b7dd017af7de4d09ef3a1cd835e8d07c8800b6a.tar.gz
Allow custom squash commit messages
Diffstat (limited to 'app/models/commit_collection.rb')
-rw-r--r--app/models/commit_collection.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/commit_collection.rb b/app/models/commit_collection.rb
index 885f61beb05..42ec5b5e664 100644
--- a/app/models/commit_collection.rb
+++ b/app/models/commit_collection.rb
@@ -3,6 +3,7 @@
# A collection of Commit instances for a specific project and Git reference.
class CommitCollection
include Enumerable
+ include Gitlab::Utils::StrongMemoize
attr_reader :project, :ref, :commits
@@ -20,11 +21,17 @@ class CommitCollection
end
def committers
- emails = commits.reject(&:merge_commit?).map(&:committer_email).uniq
+ emails = without_merge_commits.map(&:committer_email).uniq
User.by_any_email(emails)
end
+ def without_merge_commits
+ strong_memoize(:without_merge_commits) do
+ commits.reject(&:merge_commit?)
+ end
+ end
+
# Sets the pipeline status for every commit.
#
# Setting this status ahead of time removes the need for running a query for