|
13 | 13 | use File::Basename;
|
14 | 14 | use Cwd 'abs_path';
|
15 | 15 | use Term::ANSIColor qw(:constants);
|
| 16 | +use Encode qw(decode encode); |
16 | 17 |
|
17 | 18 | my $P = $0;
|
18 | 19 | my $D = dirname(abs_path($P));
|
@@ -2236,6 +2237,8 @@ sub process {
|
2236 | 2237 |
|
2237 | 2238 | our $clean = 1;
|
2238 | 2239 | my $signoff = 0;
|
| 2240 | + my $author = ''; |
| 2241 | + my $authorsignoff = 0; |
2239 | 2242 | my $is_patch = 0;
|
2240 | 2243 | my $in_header_lines = $file ? 0 : 1;
|
2241 | 2244 | my $in_commit_log = 0; #Scanning lines before patch
|
@@ -2518,10 +2521,24 @@ sub process {
|
2518 | 2521 | }
|
2519 | 2522 | }
|
2520 | 2523 |
|
| 2524 | +# Check the patch for a From: |
| 2525 | + if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) { |
| 2526 | + $author = $1; |
| 2527 | + $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i); |
| 2528 | + $author =~ s/"//g; |
| 2529 | + } |
| 2530 | + |
2521 | 2531 | # Check the patch for a signoff:
|
2522 | 2532 | if ($line =~ /^\s*signed-off-by:/i) {
|
2523 | 2533 | $signoff++;
|
2524 | 2534 | $in_commit_log = 0;
|
| 2535 | + if ($author ne '') { |
| 2536 | + my $l = $line; |
| 2537 | + $l =~ s/"//g; |
| 2538 | + if ($l =~ /^\s*signed-off-by:\s*\Q$author\E/i) { |
| 2539 | + $authorsignoff = 1; |
| 2540 | + } |
| 2541 | + } |
2525 | 2542 | }
|
2526 | 2543 |
|
2527 | 2544 | # Check if MAINTAINERS is being updated. If so, there's probably no need to
|
@@ -6507,9 +6524,14 @@ sub process {
|
6507 | 6524 | ERROR("NOT_UNIFIED_DIFF",
|
6508 | 6525 | "Does not appear to be a unified-diff format patch\n");
|
6509 | 6526 | }
|
6510 |
| - if ($is_patch && $has_commit_log && $chk_signoff && $signoff == 0) { |
6511 |
| - ERROR("MISSING_SIGN_OFF", |
6512 |
| - "Missing Signed-off-by: line(s)\n"); |
| 6527 | + if ($is_patch && $has_commit_log && $chk_signoff) { |
| 6528 | + if ($signoff == 0) { |
| 6529 | + ERROR("MISSING_SIGN_OFF", |
| 6530 | + "Missing Signed-off-by: line(s)\n"); |
| 6531 | + } elsif (!$authorsignoff) { |
| 6532 | + WARN("NO_AUTHOR_SIGN_OFF", |
| 6533 | + "Missing Signed-off-by: line by nominal patch author '$author'\n"); |
| 6534 | + } |
6513 | 6535 | }
|
6514 | 6536 |
|
6515 | 6537 | print report_dump();
|
|
0 commit comments