class Gitlab::Git::Ref
Attributes
name[R]
Branch
or tag name without “refs/tags|heads” prefix
target[R]
Target sha. Usually it is commit sha but in case when tag reference on other tag it can be tag sha
Public Class Methods
dereference_object(object)
click to toggle source
# File lib/gitlab_git/ref.rb, line 27 def self.dereference_object(object) object = object.target while object.is_a?(Rugged::Tag::Annotation) object end
extract_branch_name(str)
click to toggle source
Extract branch name from full ref path
Ex.
Ref.extract_branch_name('refs/heads/master') #=> 'master'
# File lib/gitlab_git/ref.rb, line 23 def self.extract_branch_name(str) str.gsub(/\Arefs\/heads\//, '') end
new(repository, name, target)
click to toggle source
# File lib/gitlab_git/ref.rb, line 33 def initialize(repository, name, target) encode! name @name = name.gsub(/\Arefs\/(tags|heads)\//, '') @dereferenced_target = Commit.find(repository, target) @target = if target.respond_to?(:oid) target.oid elsif target.respond_to?(:name) target.name elsif target.is_a? String target else nil end end