debian-mirror-gitlab/app/services/git/tag_hooks_service.rb

39 lines
711 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
module Git
class TagHooksService < ::Git::BaseHooksService
private
def hook_name
:tag_push_hooks
end
def commits
[tag_commit].compact
end
def event_message
tag&.message
end
def tag
strong_memoize(:tag) do
2019-12-21 20:55:43 +05:30
next if Gitlab::Git.blank_ref?(newrev)
2019-07-31 22:56:46 +05:30
2019-12-21 20:55:43 +05:30
tag_name = Gitlab::Git.ref_name(ref)
2019-07-31 22:56:46 +05:30
tag = project.repository.find_tag(tag_name)
2019-12-21 20:55:43 +05:30
tag if tag && tag.target == newrev
2019-07-31 22:56:46 +05:30
end
end
def tag_commit
strong_memoize(:tag_commit) do
project.commit(tag.dereferenced_target) if tag
end
end
end
end
2019-12-04 20:38:33 +05:30
Git::TagHooksService.prepend_if_ee('::EE::Git::TagHooksService')