mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH 03/13] checkpatch: Add warning for p0-patches
Date: Sun,  7 Dec 2008 18:30:40 +0000	[thread overview]
Message-ID: <1228674650-24392-4-git-send-email-apw@shadowen.org> (raw)
In-Reply-To: <1228674650-24392-1-git-send-email-apw@shadowen.org>

From: Wolfram Sang <w.sang@pengutronix.de>

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>
---
 scripts/checkpatch.pl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f015698..b953c76 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1057,6 +1057,7 @@ sub process {
 	my $in_comment = 0;
 	my $comment_edge = 0;
 	my $first_line = 0;
+	my $p1_prefix = '';
 
 	my $prev_values = 'E';
 
@@ -1205,7 +1206,12 @@ sub process {
 		# extract the filename as it passes
 		if ($line=~/^\+\+\+\s+(\S+)/) {
 			$realfile = $1;
-			$realfile =~ s@^[^/]*/@@;
+			$realfile =~ s@^([^/]*)/@@;
+
+			$p1_prefix = $1;
+			if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") {
+				WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
+			}
 
 			if ($realfile =~ m@^include/asm/@) {
 				ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
-- 
1.6.0.4.911.gc990


  parent reply	other threads:[~2008-12-07 18:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-07 18:30 [PATCH 00/13] update checkpatch to version 0.26 Andy Whitcroft
2008-12-07 18:30 ` [PATCH 01/13] checkpatch: update MAINTAINERS entry Andy Whitcroft
2008-12-07 18:30 ` [PATCH 02/13] checkpatch: update copyrights Andy Whitcroft
2008-12-07 18:30 ` Andy Whitcroft [this message]
2008-12-07 18:30 ` [PATCH 04/13] checkpatch: allow parentheses on return for comparisons Andy Whitcroft
2008-12-07 18:30 ` [PATCH 05/13] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h Andy Whitcroft
2008-12-07 18:30 ` [PATCH 06/13] checkpatch: loosen spacing on typedef function checks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 07/13] checkpatch: fix continuation detection when handling spacing on operators Andy Whitcroft
2008-12-07 18:30 ` [PATCH 08/13] checkpatch: track #ifdef/#else/#endif when tracking blocks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 09/13] checkpatch: do not report nr_static as a static declaration Andy Whitcroft
2008-12-07 18:30 ` [PATCH 10/13] checkpatch: ensure we actually detect if assignments split across lines Andy Whitcroft
2008-12-07 18:30 ` [PATCH 11/13] checkpatch: struct file_operations should normally be const Andy Whitcroft
2008-12-09  0:30   ` Steven Rostedt
2008-12-07 18:30 ` [PATCH 12/13] checkpatch: fix the perlcritic errors Andy Whitcroft
2008-12-07 18:30 ` [PATCH 13/13] checkpatch: version: 0.26 Andy Whitcroft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228674650-24392-4-git-send-email-apw@shadowen.org \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®