Skip to content

Commit 12c253a

Browse files
JoePerchestorvalds
authored andcommitted
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]>
1 parent 09088a4 commit 12c253a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/checkpatch.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,14 @@ sub process {
23772377

23782378
my $rawline = $rawlines[$linenr - 1];
23792379

2380+
# check if it's a mode change, rename or start of a patch
2381+
if (!$in_commit_log &&
2382+
($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2383+
($line =~ /^rename (?:from|to) \S+\s*$/ ||
2384+
$line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2385+
$is_patch = 1;
2386+
}
2387+
23802388
#extract the line range in the file after the patch is applied
23812389
if (!$in_commit_log &&
23822390
$line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {

0 commit comments

Comments
 (0)