Sha256: f8aaf4c44e17a8dd292518923c7c39f24c93679a303328706211310aa362b7de

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

require 'shellwords'

class RuboCop::Git::Commit
  # ref. https://github.com/thoughtbot/hound/blob/d2f3933/app/models/commit.rb
  def initialize(options)
    @options = options
  end

  def file_content(filename)
    if @options.cached
      `git show :#{filename.shellescape}`
    elsif @options.commit_last
      `git show #{@options.commit_last.shellescape}:#{filename.shellescape}`
    else
      File.read(filename)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-git2-0.1.6 lib/rubocop/git/commit.rb
rubocop-git2-0.1.5 lib/rubocop/git/commit.rb