From 5283469022e3c58032fae93384c2e1ed61885868 Mon Sep 17 00:00:00 2001 From: Pasi Savanainen Date: Thu, 4 Oct 2012 17:13:29 -0700 Subject: [PATCH] --- yaml --- r: 330095 b: refs/heads/master c: fa64205df9dfd7b7662cc64a7e82115c00e428e5 h: refs/heads/master i: 330093: 3b8cc8b355c383ec7c6cc54bf221a798b501a723 330091: a81f564a7bf1655bc6a6a03bac31a641aeb75754 330087: 4bf0252c80923bb34195b59b818bf339c30af828 330079: 3eb0cda1b697f68396197c4858c74879cd389816 v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 59c9646ef429..8d4eaa6ad4c9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8290e2d2dcbf0d379d4b1379e17916515ee20a39 +refs/heads/master: fa64205df9dfd7b7662cc64a7e82115c00e428e5 diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index ca05ba217f5f..5ae91889bc6b 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/scripts/checkpatch.pl @@ -1386,6 +1386,8 @@ sub process { my $in_header_lines = 1; my $in_commit_log = 0; #Scanning lines before patch + my $non_utf8_charset = 0; + our @report = (); our $cnt_lines = 0; our $cnt_error = 0; @@ -1686,10 +1688,17 @@ sub process { $in_commit_log = 1; } -# Still not yet in a patch, check for any UTF-8 - if ($in_commit_log && $realfile =~ /^$/ && +# Check if there is UTF-8 in a commit log when a mail header has explicitly +# declined it, i.e defined some charset where it is missing. + if ($in_header_lines && + $rawline =~ /^Content-Type:.+charset="(.+)".*$/ && + $1 !~ /utf-8/i) { + $non_utf8_charset = 1; + } + + if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ && $rawline =~ /$NON_ASCII_UTF8/) { - CHK("UTF8_BEFORE_PATCH", + WARN("UTF8_BEFORE_PATCH", "8-bit UTF-8 used in possible commit log\n" . $herecurr); }