Sha256: df4f12609ba293b36073c71a7eb744f4989b1a0955a5a6418e2c1ccda4bda455

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 Bytes

Contents

module Rugged
  class Branch < Rugged::Reference

    # The object pointed at by the tip of this branch
    def tip
      @owner.lookup(self.resolve.target)
    end

    def ==(other)
      other.instance_of?(Rugged::Branch) &&
        other.canonical_name == self.canonical_name
    end

    # The full name of the branch, as a fully-qualified reference
    # path.
    #
    # This is the same as calling Reference#name for the reference behind
    # the path
    alias_method 'canonical_name', 'name'

    # The name of the branch, without a fully-qualified reference path
    #
    # E.g. 'master' instead of 'refs/heads/master'
    def name
      super.gsub(%r{^(refs/heads/|refs/remotes/)}, '')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rugged-0.19.0 lib/rugged/branch.rb
rugged-0.18.0.gh.de28323 lib/rugged/branch.rb
rugged-0.18.0.b1 lib/rugged/branch.rb
rugged-0.17.0.b7 lib/rugged/branch.rb