summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e6033d3c48d3..e3b7362b0ee4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1,9 +1,11 @@
1#!/usr/bin/env perl 1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3#
2# (c) 2001, Dave Jones. (the file handling bit) 4# (c) 2001, Dave Jones. (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) 5# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) 6# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
5# (c) 2008-2010 Andy Whitcroft <apw@canonical.com> 7# (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
6# Licensed under the terms of the GNU GPL License version 2 8# (c) 2010-2018 Joe Perches <joe@perches.com>
7 9
8use strict; 10use strict;
9use warnings; 11use warnings;
@@ -2375,6 +2377,14 @@ sub process {
2375 2377
2376 my $rawline = $rawlines[$linenr - 1]; 2378 my $rawline = $rawlines[$linenr - 1];
2377 2379
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
2378#extract the line range in the file after the patch is applied 2388#extract the line range in the file after the patch is applied
2379 if (!$in_commit_log && 2389 if (!$in_commit_log &&
2380 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) { 2390 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {