Skip to content
代码片段 群组 项目
未验证 提交 477ef849 编辑于 作者: Alexandru Croitor's avatar Alexandru Croitor
浏览文件

Fix the case when diff is empty

When a file is just moved around it appears in the changed files list
but the diff is empty so we are skipping it.
上级 711cc243
No related branches found
No related tags found
无相关合并请求
...@@ -46,6 +46,11 @@ module Danger ...@@ -46,6 +46,11 @@ module Danger
def files_with_interpolated_utils(files, pattern) def files_with_interpolated_utils(files, pattern)
files.select do |file| files.select do |file|
diff = @git.diff_for_file(file) diff = @git.diff_for_file(file)
# When a file is just moved around it appears in the changed files list
# but the diff is empty so we are skipping it.
next if diff.nil?
diff.patch.each_line.any? do |line| diff.patch.each_line.any? do |line|
line.start_with?('+') && line.match?(pattern) line.start_with?('+') && line.match?(pattern)
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册