Commit d793de7a authored by Marin Jankovski's avatar Marin Jankovski

Commits in push data should always be an array.

parent 1667861e
...@@ -28,6 +28,12 @@ module Gitlab ...@@ -28,6 +28,12 @@ module Gitlab
# Get latest 20 commits ASC # Get latest 20 commits ASC
commits_limited = commits.last(20) 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" type = Gitlab::Git.tag_ref?(ref) ? "tag_push" : "push"
# Hash to be passed as post_receive_data # Hash to be passed as post_receive_data
data = { data = {
...@@ -49,17 +55,10 @@ module Gitlab ...@@ -49,17 +55,10 @@ module Gitlab
git_ssh_url: project.ssh_url_to_repo, git_ssh_url: project.ssh_url_to_repo,
visibility_level: project.visibility_level visibility_level: project.visibility_level
}, },
commits: [], commits: commit_attrs,
total_commits_count: commits_count 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 data
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment