Skip to content

Commit

Permalink
checkpatch: improve patch recognition
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JoePerches authored and torvalds committed Jun 8, 2018
1 parent 09088a4 commit 12c253a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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+))? \@\@(.*)/) {
Expand Down

0 comments on commit 12c253a

Please sign in to comment.