aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4cf4473ebf17..daf466d26a4b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1954,6 +1954,7 @@ sub process {
1954 my $in_header_lines = $file ? 0 : 1; 1954 my $in_header_lines = $file ? 0 : 1;
1955 my $in_commit_log = 0; #Scanning lines before patch 1955 my $in_commit_log = 0; #Scanning lines before patch
1956 my $commit_log_long_line = 0; 1956 my $commit_log_long_line = 0;
1957 my $commit_log_has_diff = 0;
1957 my $reported_maintainer_file = 0; 1958 my $reported_maintainer_file = 0;
1958 my $non_utf8_charset = 0; 1959 my $non_utf8_charset = 0;
1959 1960
@@ -2087,7 +2088,8 @@ sub process {
2087 my $rawline = $rawlines[$linenr - 1]; 2088 my $rawline = $rawlines[$linenr - 1];
2088 2089
2089#extract the line range in the file after the patch is applied 2090#extract the line range in the file after the patch is applied
2090 if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { 2091 if (!$in_commit_log &&
2092 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
2091 $is_patch = 1; 2093 $is_patch = 1;
2092 $first_line = $linenr + 1; 2094 $first_line = $linenr + 1;
2093 $realline=$1-1; 2095 $realline=$1-1;
@@ -2181,6 +2183,17 @@ sub process {
2181 2183
2182 $cnt_lines++ if ($realcnt != 0); 2184 $cnt_lines++ if ($realcnt != 0);
2183 2185
2186# Check if the commit log has what seems like a diff which can confuse patch
2187 if ($in_commit_log && !$commit_log_has_diff &&
2188 (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
2189 $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) ||
2190 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2191 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2192 ERROR("DIFF_IN_COMMIT_MSG",
2193 "Avoid using diff content in the commit message - patch(1) might not work\n" . $herecurr);
2194 $commit_log_has_diff = 1;
2195 }
2196
2184# Check for incorrect file permissions 2197# Check for incorrect file permissions
2185 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { 2198 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
2186 my $permhere = $here . "FILE: $realfile\n"; 2199 my $permhere = $here . "FILE: $realfile\n";