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

git_ref_validator.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0e87ee30c985d7bf225674475fe31812bd77fae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Gitlab
  module GitRefValidator
    extend self
    # Validates a given name against the git reference specification
    #
    # Returns true for a valid reference name, false otherwise
    def validate(ref_name)
      return false if ref_name.start_with?('refs/heads/')
      return false if ref_name.start_with?('refs/remotes/')

      Gitlab::Utils.system_silent(
        %W(#{Gitlab.config.git.bin_path} check-ref-format refs/#{ref_name}))
    end
  end
end