]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
checkpatch: improve patch recognition
authorJoe Perches <joe@perches.com>
Fri, 8 Jun 2018 00:10:58 +0000 (17:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Jun 2018 00:34:39 +0000 (17:34 -0700)
There are mode change and rename only patches that are unrecognized by
checkpatch.

Recognize them.

[joe@perches.com: fix missing close parenthesis]
Link: http://lkml.kernel.org/r/af44c893f6973393f2a5b11f1a8e5cd4c8bbbba5.camel@perches.com
Link: http://lkml.kernel.org/r/974a407e6fa18abd5a965da39cc68986a4c4f091.1526949367.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index dfd265e036f3b7dabe329bf81812b2567a46549e..e3b7362b0ee457b9601a8628609d8ebf78fcb09a 100755 (executable)
@@ -2377,6 +2377,14 @@ sub process {
 
                my $rawline = $rawlines[$linenr - 1];
 
+# check if it's a mode change, rename or start of a patch
+               if (!$in_commit_log &&
+                   ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
+                   ($line =~ /^rename (?:from|to) \S+\s*$/ ||
+                    $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
+                       $is_patch = 1;
+               }
+
 #extract the line range in the file after the patch is applied
                if (!$in_commit_log &&
                    $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {