Sha256: 85fb4db22b08835306aee87384f0ea209176c2bcd612b8575073fc090177300e

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

module Gitlab
  module Git
    class Ref
      # Branch or tag name
      # without "refs/tags|heads" prefix
      attr_reader :name

      # Target sha.
      # Usually it is commit sha but in case
      # when tag reference on other tag it can be tag sha
      attr_reader :target

      # Extract branch name from full ref path
      #
      # Ex.
      #   Ref.extract_branch_name('refs/heads/master') #=> 'master'
      def self.extract_branch_name(str)
        str.gsub(/\Arefs\/heads\//, '')
      end

      def initialize(name, target)
        @name, @target = name.gsub(/\Arefs\/(tags|heads)\//, ''), target.oid
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab_git-6.2.0 lib/gitlab_git/ref.rb