Sha256: 179eca9bb7e653997c13972c8b7f16fb532fcad077af23f9dad984a62d0e5b25

Contents?: true

Size: 538 Bytes

Versions: 6

Compression:

Stored size: 538 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, "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, "Could not find branch {{error:#{name}}}"
    end

    alias to_s name
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rfix-1.4.1 lib/rfix/branches/name.rb
rfix-1.4.0.pre.201 lib/rfix/branches/name.rb
rfix-1.4.0 lib/rfix/branches/name.rb
rfix-1.3.0.pre.199 lib/rfix/branches/name.rb
rfix-1.2.6.pre.198 lib/rfix/branches/name.rb
rfix-1.2.6 lib/rfix/branches/name.rb