aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2009-01-06 17:41:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:16 -0500
commit1e85572697b348b1a126520349a29654f2ae6a12 (patch)
tree1ce7febee025caa781c586090983718fde900c56 /scripts/checkpatch.pl
parent2a5a2c25224e26c5ee491af0dc5d39e4a16f619c (diff)
checkpatch: Add warning for p0-patches
Some people work internally with -p0-patches which has the danger that one forgets to convert them to -p1 before mainlining. Bitten myself and seen p0-patches in mailing lists occasionally, this patch adds a warning to checkpatch.pl in case a patch is -p0. If you really want, you can fool this check to generate false positives, this is why it just spits a warning. Making the check 100% proof is trickier than it looks, so let's start with a version which catches the cases of real use. [apw@canonical.com: update message language, handle null prefix, add tests] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f01569847969..b953c76be369 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1057,6 +1057,7 @@ sub process {
1057 my $in_comment = 0; 1057 my $in_comment = 0;
1058 my $comment_edge = 0; 1058 my $comment_edge = 0;
1059 my $first_line = 0; 1059 my $first_line = 0;
1060 my $p1_prefix = '';
1060 1061
1061 my $prev_values = 'E'; 1062 my $prev_values = 'E';
1062 1063
@@ -1205,7 +1206,12 @@ sub process {
1205 # extract the filename as it passes 1206 # extract the filename as it passes
1206 if ($line=~/^\+\+\+\s+(\S+)/) { 1207 if ($line=~/^\+\+\+\s+(\S+)/) {
1207 $realfile = $1; 1208 $realfile = $1;
1208 $realfile =~ s@^[^/]*/@@; 1209 $realfile =~ s@^([^/]*)/@@;
1210
1211 $p1_prefix = $1;
1212 if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") {
1213 WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
1214 }
1209 1215
1210 if ($realfile =~ m@^include/asm/@) { 1216 if ($realfile =~ m@^include/asm/@) {
1211 ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n"); 1217 ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");