lib/mutant/repository/diff.rb in mutant-0.9.8 vs lib/mutant/repository/diff.rb in mutant-0.9.9
- old
+ new
@@ -27,14 +27,10 @@
.touches?(line_range)
end
private
- # Touched paths
- #
- # @return [Hash{Pathname => Path}]
- #
# rubocop:disable Metrics/MethodLength
def touched_paths
pathname = world.pathname
work_dir = pathname.pwd
@@ -47,17 +43,12 @@
[path.path, path]
end
.to_h
end
memoize :touched_paths
+ # rubocop:enable Metrics/MethodLength
- # Parse path
- #
- # @param [Pathname] work_dir
- # @param [String] line
- #
- # @return [Path]
def parse_line(work_dir, line)
match = FORMAT.match(line) or fail Error, "Invalid git diff-index line: #{line}"
Path.new(
path: work_dir.join(match.captures.first),
@@ -86,12 +77,9 @@
end
end
private
- # Ranges of hunks in the diff
- #
- # @return [Array<Range<Integer>>]
def diff_ranges
world
.capture_stdout(%W[git diff --unified=0 #{to} -- #{path}])
.fmap(&Ranges.method(:parse))
.from_right