Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tag_hooks_service.rb « git « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d83924fec28d91093457f19533ca822b5997032c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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
        next if Gitlab::Git.blank_ref?(newrev)

        tag_name = Gitlab::Git.ref_name(ref)
        tag = project.repository.find_tag(tag_name)

        tag if tag && tag.target == newrev
      end
    end

    def tag_commit
      strong_memoize(:tag_commit) do
        project.commit(tag.dereferenced_target) if tag
      end
    end
  end
end

Git::TagHooksService.prepend_mod_with('Git::TagHooksService')