checkpatch: warn on bare SHA-1 commit IDs in commit logs
Commit IDs should have commit descriptions too. Warn when a 12 to 40 byte SHA-1 is used in commit logs. 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>
This commit is contained in:
parent
6b4a35fc19
commit
fe043ea120
1 changed files with 12 additions and 3 deletions
|
@ -2317,9 +2317,11 @@ sub process {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for git id commit length and improperly formed commit descriptions
|
# Check for git id commit length and improperly formed commit descriptions
|
||||||
if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) {
|
if ($in_commit_log &&
|
||||||
my $init_char = $1;
|
($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
|
||||||
my $orig_commit = lc($2);
|
$line =~ /\b[0-9a-f]{12,40}\b/i)) {
|
||||||
|
my $init_char = "c";
|
||||||
|
my $orig_commit = "";
|
||||||
my $short = 1;
|
my $short = 1;
|
||||||
my $long = 0;
|
my $long = 0;
|
||||||
my $case = 1;
|
my $case = 1;
|
||||||
|
@ -2330,6 +2332,13 @@ sub process {
|
||||||
my $orig_desc = "commit description";
|
my $orig_desc = "commit description";
|
||||||
my $description = "";
|
my $description = "";
|
||||||
|
|
||||||
|
if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
|
||||||
|
$init_char = $1;
|
||||||
|
$orig_commit = lc($2);
|
||||||
|
} elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) {
|
||||||
|
$orig_commit = lc($1);
|
||||||
|
}
|
||||||
|
|
||||||
$short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
|
$short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
|
||||||
$long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
|
$long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
|
||||||
$space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
|
$space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
|
||||||
|
|
Loading…
Reference in a new issue