diff options
author | Joe Perches <[email protected]> | 2018-06-07 17:10:58 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-06-07 17:34:39 -0700 |
commit | 12c253abb9c9d8e01d9365fc8cbde4688731f401 (patch) | |
tree | 69fb79eb7685ce8f9b0ff2cf682be56ce5c27fae | |
parent | 09088a4047e2d1e749f8ceab1f39c5c0055032e5 (diff) |
checkpatch: improve patch recognition
There are mode change and rename only patches that are unrecognized by
checkpatch.
Recognize them.
[[email protected]: fix missing close parenthesis]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/974a407e6fa18abd5a965da39cc68986a4c4f091.1526949367.git.joe@perches.com
Signed-off-by: Joe Perches <[email protected]>
Reported-by: Heinrich Schuchardt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rwxr-xr-x | scripts/checkpatch.pl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index dfd265e036f3..e3b7362b0ee4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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+))? \@\@(.*)/) { |