diff options
Diffstat (limited to 'lib/gitlab/git/ref.rb')
-rw-r--r-- | lib/gitlab/git/ref.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gitlab/git/ref.rb b/lib/gitlab/git/ref.rb index 37ef6836742..1bec44b4645 100644 --- a/lib/gitlab/git/ref.rb +++ b/lib/gitlab/git/ref.rb @@ -12,10 +12,6 @@ module Gitlab # when tag reference on other tag it can be tag sha attr_reader :target - # Dereferenced target - # Commit object to which the Ref points to - attr_reader :dereferenced_target - # Extract branch name from full ref path # # Ex. @@ -33,7 +29,7 @@ module Gitlab def initialize(repository, name, target) encode! name @name = name.gsub(/\Arefs\/(tags|heads)\//, '') - @dereferenced_target = Gitlab::Git::Commit.find(repository, target) + @repository = repository @target = if target.respond_to?(:oid) target.oid elsif target.respond_to?(:name) @@ -44,6 +40,12 @@ module Gitlab nil end end + + # Dereferenced target + # Commit object to which the Ref points to + def dereferenced_target + @dereferenced_target ||= Gitlab::Git::Commit.find(@repository, target) + end end end end |