[PATCH 3/4] Add git commit header and description check

Yang Gu yang.gu at intel.com
Sun Jul 18 23:19:28 PDT 2010


---
 test/checkpatch.pl |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/test/checkpatch.pl b/test/checkpatch.pl
index 2d5ece7..767670d 100755
--- a/test/checkpatch.pl
+++ b/test/checkpatch.pl
@@ -1260,6 +1260,24 @@ sub process {
 
 		$cnt_lines++ if ($realcnt != 0);
 
+#check the commit header and description
+        if ($line =~ /Subject: \[PATCH.*\] (.*)/) {
+            my $header = $1;
+            if (length($header) > 50) {
+            	ERROR("Commit header exceeds the limitation of 50 characters\n");
+            }            
+            my @desc;
+            my $desc_linenr = $linenr;
+            my $desc_line = $lines[$desc_linenr++];
+            while ($desc_line ne "---") {
+                if (length($desc_line) > 72) {               
+                    ERROR("Commit description exceeds the limitation of 72 characters\n#".($desc_linenr-$linenr-1).": ".$desc_line."\n");   
+                }
+                $desc_line = $lines[$desc_linenr++];
+            }
+            
+        }
+
 #check the patch for a signoff:
 		if ($line =~ /^\s*signed-off-by:/i) {
 			# This is a signoff, if ugly, so do not double report.
-- 
1.7.0.4



More information about the ofono mailing list