From 477ef849abfeb3654c370296e07144d70ba235f8 Mon Sep 17 00:00:00 2001
From: Alexandru Croitor <acroitor@gitlab.com>
Date: Fri, 19 Apr 2024 12:14:23 +0300
Subject: [PATCH] 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.
---
 danger/tailwindcss/Dangerfile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/danger/tailwindcss/Dangerfile b/danger/tailwindcss/Dangerfile
index 2975d373abdcd..f32e6d0d7cac1 100644
--- a/danger/tailwindcss/Dangerfile
+++ b/danger/tailwindcss/Dangerfile
@@ -46,6 +46,11 @@ module Danger
     def files_with_interpolated_utils(files, pattern)
       files.select do |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|
           line.start_with?('+') && line.match?(pattern)
         end
-- 
GitLab