2014-11-03 19:02:12 +00:00
|
|
|
module Gitlab
|
|
|
|
module Git
|
2015-11-03 12:09:18 +00:00
|
|
|
BLANK_SHA = ('0' * 40).freeze
|
2015-11-02 18:02:08 +00:00
|
|
|
TAG_REF_PREFIX = "refs/tags/".freeze
|
|
|
|
BRANCH_REF_PREFIX = "refs/heads/".freeze
|
2015-01-15 18:26:33 +00:00
|
|
|
|
2015-03-10 10:51:36 +00:00
|
|
|
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-15 01:30:55 +00:00
|
|
|
|
|
|
|
def version
|
|
|
|
Gitlab::VersionInfo.parse(Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} --version)).first)
|
|
|
|
end
|
2015-01-15 18:26:33 +00:00
|
|
|
end
|
2014-11-03 19:02:12 +00:00
|
|
|
end
|
|
|
|
end
|