From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: Fabian Frederick <fabf@skynet.be>,
Andrew Morton <akpm@linux-foundation.org>,
Joe Perches <joe@perches.com>
Subject: [PATCH 1/1] checkpatch: check for subject uniqueness in git repository.
Date: Mon, 15 Sep 2014 20:43:57 +0200 [thread overview]
Message-ID: <1410806637-3510-1-git-send-email-fabf@skynet.be> (raw)
Adding patch subject uniqueness check in checkpatch --strict mode.
See Documentation/SubmittingPatches/globally-unique identifier.
Inspired-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
scripts/checkpatch.pl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0c520f7..2be06c9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1810,6 +1810,7 @@ sub process {
our $clean = 1;
my $signoff = 0;
+ my $git_samesubjects = 0;
my $is_patch = 0;
my $in_header_lines = $file ? 0 : 1;
@@ -2047,6 +2048,15 @@ sub process {
}
}
+# Check patch subject on subjective/strict check mode
+ if ($check && $line =~ /^Subject: \[(.*)\](.*)/) {
+ my $subject = $2;
+ if ($quiet == 0) {
+ print "Looking for patches with the same subject in git repository ...\n";
+ }
+ $git_samesubjects = `git log --oneline | grep -m1 "$subject\$" | wc -l`;
+ }
+
# Check the patch for a signoff:
if ($line =~ /^\s*signed-off-by:/i) {
$signoff++;
@@ -5091,6 +5101,10 @@ sub process {
ERROR("MISSING_SIGN_OFF",
"Missing Signed-off-by: line(s)\n");
}
+ if ($is_patch && $git_samesubjects > 0) {
+ WARN("NOT_UNIQUE_SUBJECT",
+ "similar subjects found in git repository\n");
+ }
print report_dump();
if ($summary && !($clean == 1 && $quiet == 1)) {
--
1.9.1
next reply other threads:[~2014-09-15 18:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 18:43 Fabian Frederick [this message]
2014-09-15 21:02 ` [PATCH 1/1] checkpatch: check for subject uniqueness in git repository Joe Perches
2014-09-16 3:22 ` Joe Perches
2014-09-16 16:15 ` Fabian Frederick
2014-09-16 16:31 ` Joe Perches
2014-09-20 10:31 ` Fabian Frederick
2014-09-20 16:07 ` Joe Perches
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=1410806637-3510-1-git-send-email-fabf@skynet.be \
--to=fabf@skynet.be \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).