Sha256: 7f0628cd41cc4eca1748f1a19eaaa29ba59d7faf6cf34285132e79ae6e42dd52

Contents?: true

Size: 546 Bytes

Versions: 9

Compression:

Stored size: 546 Bytes

Contents

require_relative "base"

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

9 entries across 9 versions & 1 rubygems

Version Path
rfix-1.2.2.pre.174 lib/rfix/branches/name.rb
rfix-1.2.5 lib/rfix/branches/name.rb
rfix-1.2.4 lib/rfix/branches/name.rb
rfix-1.2.3.pre lib/rfix/branches/name.rb
rfix-1.2.2.pre lib/rfix/branches/name.rb
rfix-1.2.2.pre.172 lib/rfix/branches/name.rb
rfix-1.2.2 lib/rfix/branches/name.rb
rfix-1.2.0 lib/rfix/branches/name.rb
rfix-1.1.4.pre lib/rfix/branches/name.rb