summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-19 17:22:46 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-19 17:22:46 +0000
commit91c65d03b56a4ec776f2eb4d1e87cb1157a9221e (patch)
tree90624dc2478d13fe73111fa4876046d371c298b5
parent1667861ed2987bc3156af33700c48609b61546c8 (diff)
parentd793de7ad7c9f9a585e5938bb153ed30c22ea985 (diff)
downloadgitlab-ce-91c65d03b56a4ec776f2eb4d1e87cb1157a9221e.tar.gz
Merge branch 'commits_in_push_data' into '7-9-stable'
Commits in push data should always be an array. See merge request !1726
-rw-r--r--lib/gitlab/push_data_builder.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb
index ea9012b8844..1e35f67ca0f 100644
--- a/lib/gitlab/push_data_builder.rb
+++ b/lib/gitlab/push_data_builder.rb
@@ -28,6 +28,12 @@ module Gitlab
# Get latest 20 commits ASC
commits_limited = commits.last(20)
+ # For performance purposes maximum 20 latest commits
+ # will be passed as post receive hook data.
+ commit_attrs = commits_limited.map do |commit|
+ commit.hook_attrs(project)
+ end
+
type = Gitlab::Git.tag_ref?(ref) ? "tag_push" : "push"
# Hash to be passed as post_receive_data
data = {
@@ -49,17 +55,10 @@ module Gitlab
git_ssh_url: project.ssh_url_to_repo,
visibility_level: project.visibility_level
},
- commits: [],
+ commits: commit_attrs,
total_commits_count: commits_count
}
- # For performance purposes maximum 20 latest commits
- # will be passed as post receive hook data.
- commits_limited.each do |commit|
- data[:commits] << commit.hook_attrs(project)
- end
-
- data[:commits] = "" if data[:commits].count == 0
data
end