lib/devloop/diff_parser.rb in devloop-0.0.7 vs lib/devloop/diff_parser.rb in devloop-0.0.8

- old
+ new

@@ -8,15 +8,21 @@ _, results = diff.split("\n").reduce(["", []]) do |(file, results), line| if line.start_with?("+++ b/") [line[6..-1], results] elsif line.start_with?("@@ -") line_number = line.match(/@@ -(\d+)/)[1] - [file, results << "#{relative_path(file)}:#{line_number}"] + if line_number == "1" + [file, results << "#{relative_path(file)}"] + else + [file, results << "#{relative_path(file)}:#{line_number}"] + end else [file, results] end - end - results + end.uniq + + # Remove filenames with line number if filename without line number is present + results.reject { |result| results.include?(result.split(":").first) && result.include?(":") } end private def relative_path(path)