linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] checkpatch: check for subject uniqueness in git repository.
@ 2014-09-15 18:43 Fabian Frederick
  2014-09-15 21:02 ` Joe Perches
  2014-09-16  3:22 ` Joe Perches
  0 siblings, 2 replies; 7+ messages in thread
From: Fabian Frederick @ 2014-09-15 18:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Andrew Morton, Joe Perches

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-20 16:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 18:43 [PATCH 1/1] checkpatch: check for subject uniqueness in git repository Fabian Frederick
2014-09-15 21:02 ` 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

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).