diff options
author | Vinnie Okada <vokada@mrvinn.com> | 2015-03-21 18:03:35 +0300 |
---|---|---|
committer | Vinnie Okada <vokada@mrvinn.com> | 2015-03-21 18:03:35 +0300 |
commit | f5e65e2e508269ff7c18318526ba01f8e7d83951 (patch) | |
tree | dd834b066dc51de87139d69ea042e0bdfd69334d /lib/gitlab/push_data_builder.rb | |
parent | cc29ce491786d631586c3b0d0da310b8b790a673 (diff) | |
parent | 6cf189f0a92772b9174f913e7c74a4889d54e9a6 (diff) |
Merge branch 'master' into markdown-tags
Merge updated CHANGELOG entries
Diffstat (limited to 'lib/gitlab/push_data_builder.rb')
-rw-r--r-- | lib/gitlab/push_data_builder.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb index ea9012b8844..948cf58fd9a 100644 --- a/lib/gitlab/push_data_builder.rb +++ b/lib/gitlab/push_data_builder.rb @@ -27,6 +27,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 @@ -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 @@ -72,7 +71,8 @@ module Gitlab end def checkout_sha(repository, newrev, ref) - if newrev != Gitlab::Git::BLANK_SHA && Gitlab::Git.tag_ref?(ref) + # Find sha for tag, except when it was deleted. + if Gitlab::Git.tag_ref?(ref) && !Gitlab::Git.blank_ref?(newrev) tag_name = Gitlab::Git.ref_name(ref) tag = repository.find_tag(tag_name) |