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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
775 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
2021-11-11 11:23:49 +05:30
def limited_commits
2019-07-31 22:56:46 +05:30
[tag_commit].compact
end
2021-11-11 11:23:49 +05:30
def commits_count
limited_commits.count
end
2019-07-31 22:56:46 +05:30
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
2021-06-08 01:23:25 +05:30
Git::TagHooksService.prepend_mod_with('Git::TagHooksService')