diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-27 19:16:31 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-04-27 19:16:31 +0000 |
commit | 5976195fef53fe1bc56647dfc06049a8f984d5fe (patch) | |
tree | 06b169be546df8c91ef8709add735b937dce0497 /lib/gitlab | |
parent | 419f39e34d7ca741b33e4dbc2b864c21e60bb164 (diff) | |
parent | 6368072fd7bbee0f79de358aa8645f463d768bef (diff) | |
download | gitlab-ce-5976195fef53fe1bc56647dfc06049a8f984d5fe.tar.gz |
Merge branch '31138-improve-test-settings-for-services-in-empty-projects' into 'master'
improves test settings for chat notification services for empty projects
Closes #31138
See merge request !10886
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/data_builder/push.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/gitlab/data_builder/push.rb b/lib/gitlab/data_builder/push.rb index d76aa38f741..1ff34553f0a 100644 --- a/lib/gitlab/data_builder/push.rb +++ b/lib/gitlab/data_builder/push.rb @@ -41,7 +41,7 @@ module Gitlab type = Gitlab::Git.tag_ref?(ref) ? 'tag_push' : 'push' # Hash to be passed as post_receive_data - data = { + { object_kind: type, event_name: type, before: oldrev, @@ -61,16 +61,15 @@ module Gitlab repository: project.hook_attrs.slice(:name, :url, :description, :homepage, :git_http_url, :git_ssh_url, :visibility_level) } - - data end # This method provide a sample data generated with # existing project and commits to test webhooks def build_sample(project, user) - commits = project.repository.commits(project.default_branch, limit: 3) ref = "#{Gitlab::Git::BRANCH_REF_PREFIX}#{project.default_branch}" - build(project, user, commits.last.id, commits.first.id, ref, commits) + commits = project.repository.commits(project.default_branch.to_s, limit: 3) rescue [] + + build(project, user, commits.last&.id, commits.first&.id, ref, commits) end def checkout_sha(repository, newrev, ref) |