[PATCH 2/2] checkpatch: Don't check for unified diff format in git sendemail headers

From: Saravana Kannan
Date: Thu Feb 22 2024 - 00:16:24 EST


When checkpatch is used as a git sendemail-validate hook, it's also passed
in the email header for sanity check. These headers are, as expected, not
in unified diff format. So, don't complain about unified diff format for
these header files.

Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f306634a938c..4312166ca828 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7689,7 +7689,8 @@ sub process {
exit(0);
}

- if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
+ if (!$is_patch && $filename !~ /cover-letter\.patch$/ &&
+ $filename !~ /\.git\/\.gitsendemail\.header\.\w+$/) {
ERROR("NOT_UNIFIED_DIFF",
"Does not appear to be a unified-diff format patch\n");
}
--
2.44.0.rc0.258.g7320e95886-goog