Sha256: 8a429fa89c66bb4a227282d742085e2e21396c046d5b3f1ec64b86b8967ec04a

Contents?: true

Size: 646 Bytes

Versions: 13

Compression:

Stored size: 646 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
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gitlab_git-6.1.0 lib/gitlab_git/ref.rb
gitlab_git-6.0.1 lib/gitlab_git/ref.rb
gitlab_git-6.0.0 lib/gitlab_git/ref.rb
gitlab_git-5.9.0 lib/gitlab_git/ref.rb
gitlab_git-5.8.0 lib/gitlab_git/ref.rb
gitlab_git-5.7.1 lib/gitlab_git/ref.rb
gitlab_git-5.7.0 lib/gitlab_git/ref.rb
gitlab_git-5.6.0 lib/gitlab_git/ref.rb
gitlab_git-5.5.0 lib/gitlab_git/ref.rb
gitlab_git-5.4.0 lib/gitlab_git/ref.rb
gitlab_git-5.3.0 lib/gitlab_git/ref.rb
gitlab_git-5.2.0 lib/gitlab_git/ref.rb
gitlab_git-5.1.0 lib/gitlab_git/ref.rb