gitlab-org--gitlab-foss/lib/gitlab/git.rb

30 lines
618 B
Ruby
Raw Normal View History

module Gitlab
module Git
BLANK_SHA = ('0' * 40).freeze
2015-11-02 13:02:08 -05:00
TAG_REF_PREFIX = "refs/tags/".freeze
BRANCH_REF_PREFIX = "refs/heads/".freeze
class << self
def ref_name(ref)
ref.gsub(/\Arefs\/(tags|heads)\//, '')
end
def tag_ref?(ref)
ref.start_with?(TAG_REF_PREFIX)
end
def branch_ref?(ref)
ref.start_with?(BRANCH_REF_PREFIX)
end
def blank_ref?(ref)
ref == BLANK_SHA
end
2015-12-14 20:30:55 -05:00
def version
Gitlab::VersionInfo.parse(Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} --version)).first)
end
end
end
end