Sha256: 39b4ce42e9a5932c54c8f3cbdffe26bb8d32dc1011e90404628801d59aab5253

Contents?: true

Size: 768 Bytes

Versions: 12

Compression:

Stored size: 768 Bytes

Contents

module R10K
module Git
  class NonexistentHashError < StandardError
    # Raised when a hash was requested that can't be found in the repository

    attr_reader :hash
    attr_reader :git_dir

    def initialize(msg = nil, git_dir = nil)
      super(msg)

      @git_dir = git_dir
    end

    HASHLIKE = %r[[A-Fa-f0-9]]

    # Print a friendly error message if an object hash is given as the message
    def message
      msg = super
      if msg and msg.match(HASHLIKE)
        msg = "Could not locate hash #{msg.inspect} in repository"
      elsif msg.nil?
        msg = "Could not locate hash in repository"
      end

      if @git_dir
        msg << " at #{@git_dir}. (Does the remote repository need to be updated?)"
      end

      msg
    end
  end
end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
r10k-1.1.4 lib/r10k/git/errors.rb
r10k-1.1.3 lib/r10k/git/errors.rb
r10k-1.1.2 lib/r10k/git/errors.rb
r10k-1.1.1 lib/r10k/git/errors.rb
r10k-1.1.1rc1 lib/r10k/git/errors.rb
r10k-1.1.0 lib/r10k/git/errors.rb
r10k-1.1.0rc1 lib/r10k/git/errors.rb
r10k-1.0.0 lib/r10k/git/errors.rb
r10k-1.0.0rc4 lib/r10k/git/errors.rb
r10k-1.0.0rc3 lib/r10k/git/errors.rb
r10k-1.0.0rc2 lib/r10k/git/errors.rb
r10k-1.0.0rc1 lib/r10k/git/errors.rb