lib/rubocop/git/pseudo_pull_request.rb in rubocop-git-0.0.1 vs lib/rubocop/git/pseudo_pull_request.rb in rubocop-git-0.0.2
- old
+ new
@@ -16,11 +16,11 @@
build_commit_file(file)
end
end
def config
- return unless @options[:hound]
+ return unless @options.hound
File.read(HOUND_CONFIG_FILE)
rescue Errno::ENOENT
nil
end
@@ -29,11 +29,13 @@
def build_commit_file(file)
CommitFile.new(file, file_contents(file.filename))
end
def file_contents(filename)
- if @options[:cached]
+ 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