Sha256: 634ae83902cec3f67e53ad7f0f91d52761c67e1f511d11c9580e4681254b8df4

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

module Rfix
  class Branch::Name < Branch::Base
    attr_reader :name

    def initialize(name)
      @name = name
    end

    def resolve(with:)
      unless branch = with.branches[name]
        raise Branch::UnknownBranchError.new("Could not find branch {{error:#{name}}}")
      end
      
      with.lookup(with.merge_base(branch.target_id, with.head.target_id))
    rescue Rugged::ReferenceError
      raise Branch::UnknownBranchError.new("Could not find branch {{error:#{name}}}")
    end

    alias to_s name
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rfix-1.1.0.pre.150 lib/rfix/branches/name.rb
rfix-1.1.1.pre lib/rfix/branches/name.rb
rfix-1.1.0.pre.149 lib/rfix/branches/name.rb
rfix-1.1.0.pre.147 lib/rfix/branches/name.rb