Adding patch subject uniqueness check in checkpatch --strict mode.
See Documentation/SubmittingPatches/globally-unique identifier.

Inspired-by: Andrew Morton <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to