diff options
author | Joe Perches <joe@perches.com> | 2015-02-13 17:39:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:40 -0500 |
commit | 19c146a64c5e14c5dd910e930565edf74637a423 (patch) | |
tree | abf95c58d15f3cc2e5e038510001d3066e2959c3 /scripts/checkpatch.pl | |
parent | d2e025f364369dbe0a7dee1b15f198f5718f246a (diff) |
checkpatch: make sure a commit reference description uses parentheses
The preferred style for a commit reference in a commit log is:
commit <foo> ("<title line>")
A recent commit removed this check for parentheses. Add it back.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 32bd31c1345c..3642b0d5ad6a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2191,6 +2191,7 @@ sub process { | |||
2191 | my $case = 1; | 2191 | my $case = 1; |
2192 | my $space = 1; | 2192 | my $space = 1; |
2193 | my $hasdesc = 0; | 2193 | my $hasdesc = 0; |
2194 | my $hasparens = 0; | ||
2194 | my $id = '0123456789ab'; | 2195 | my $id = '0123456789ab'; |
2195 | my $orig_desc = "commit description"; | 2196 | my $orig_desc = "commit description"; |
2196 | my $description = ""; | 2197 | my $description = ""; |
@@ -2201,10 +2202,12 @@ sub process { | |||
2201 | $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); | 2202 | $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); |
2202 | if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { | 2203 | if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { |
2203 | $orig_desc = $1; | 2204 | $orig_desc = $1; |
2205 | $hasparens = 1; | ||
2204 | } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && | 2206 | } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && |
2205 | defined $rawlines[$linenr] && | 2207 | defined $rawlines[$linenr] && |
2206 | $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { | 2208 | $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { |
2207 | $orig_desc = $1; | 2209 | $orig_desc = $1; |
2210 | $hasparens = 1; | ||
2208 | } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && | 2211 | } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && |
2209 | defined $rawlines[$linenr] && | 2212 | defined $rawlines[$linenr] && |
2210 | $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { | 2213 | $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { |
@@ -2212,12 +2215,13 @@ sub process { | |||
2212 | $orig_desc = $1; | 2215 | $orig_desc = $1; |
2213 | $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; | 2216 | $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; |
2214 | $orig_desc .= " " . $1; | 2217 | $orig_desc .= " " . $1; |
2218 | $hasparens = 1; | ||
2215 | } | 2219 | } |
2216 | 2220 | ||
2217 | ($id, $description) = git_commit_info($orig_commit, | 2221 | ($id, $description) = git_commit_info($orig_commit, |
2218 | $id, $orig_desc); | 2222 | $id, $orig_desc); |
2219 | 2223 | ||
2220 | if ($short || $long || $space || $case || ($orig_desc ne $description)) { | 2224 | if ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens) { |
2221 | ERROR("GIT_COMMIT_ID", | 2225 | ERROR("GIT_COMMIT_ID", |
2222 | "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr); | 2226 | "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr); |
2223 | } | 2227 | } |