public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] scripts: Improve patch recognition
@ 2018-05-22  0:38 Joe Perches
  2018-05-22  0:38 ` [PATCH 1/2] checkpatch: " Joe Perches
  2018-05-22  0:38 ` [PATCH 2/2] get_maintainer: Improve " Joe Perches
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2018-05-22  0:38 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: Heinrich Schuchardt, Andy Whitcroft

checkpatch and get_maintainer do properly recognize rename only and
mode-change only patches.  Improve their logic to do so.

Joe Perches (2):
  checkpatch: Improve patch recognition
  get_maintainer: Improve patch recognition

 scripts/checkpatch.pl     |  8 ++++++++
 scripts/get_maintainer.pl | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] checkpatch: Improve patch recognition
  2018-05-22  0:38 [PATCH 0/2] scripts: Improve patch recognition Joe Perches
@ 2018-05-22  0:38 ` Joe Perches
  2018-05-30 16:51   ` [PATCH] FIXUP checkpatch: improve " Gwendal Grignou
  2018-05-22  0:38 ` [PATCH 2/2] get_maintainer: Improve " Joe Perches
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2018-05-22  0:38 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft; +Cc: Heinrich Schuchardt, linux-kernel

There are mode change and rename only patches that are unrecognized
by checkpatch.

Recognize them.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index baddac9379f0..61849a4d7132 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2375,6 +2375,14 @@ sub process {
 
 		my $rawline = $rawlines[$linenr - 1];
 
+# check if it's a mode change, rename or start of a patch
+		if (!$in_commit_log &&
+		    ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
+		    ($line =~ /^rename (?:from|to) \S+\s*$/ ||
+		     $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/)) {
+			$is_patch = 1;
+		}
+
 #extract the line range in the file after the patch is applied
 		if (!$in_commit_log &&
 		    $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] get_maintainer: Improve patch recognition
  2018-05-22  0:38 [PATCH 0/2] scripts: Improve patch recognition Joe Perches
  2018-05-22  0:38 ` [PATCH 1/2] checkpatch: " Joe Perches
@ 2018-05-22  0:38 ` Joe Perches
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2018-05-22  0:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Heinrich Schuchardt, linux-kernel

There are mode change and rename only patches that are unrecognized
by the get_maintainer.pl script.

Recognize them.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/get_maintainer.pl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 99c96e86eccb..0d987ef5e0ab 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -542,7 +542,18 @@ foreach my $file (@ARGV) {
 
 	while (<$patch>) {
 	    my $patch_line = $_;
-	    if (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) {
+	    if (m/^ mode change [0-7]+ => [0-7]+ (\S+)\s*$/) {
+		my $filename = $1;
+		push(@files, $filename);
+	    } elsif (m/^rename (?:from|to) (\S+)\s*$/) {
+		my $filename = $1;
+		push(@files, $filename);
+	    } elsif (m/^diff --git a\/(\S+) b\/(\S+)\s*$/) {
+		my $filename1 = $1;
+		my $filename2 = $2;
+		push(@files, $filename1);
+		push(@files, $filename2);
+	    } elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) {
 		my $filename = $1;
 		$filename =~ s@^[^/]*/@@;
 		$filename =~ s@\n@@;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] FIXUP checkpatch: improve patch recognition
  2018-05-22  0:38 ` [PATCH 1/2] checkpatch: " Joe Perches
@ 2018-05-30 16:51   ` Gwendal Grignou
  2018-05-30 17:02     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Gwendal Grignou @ 2018-05-30 16:51 UTC (permalink / raw)
  To: joe; +Cc: linux-kernel

Fix syntax error in patch.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f1fecd8aa4d7..03dd7b6b0eab 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2378,7 +2378,7 @@ sub process {
 # check if it's a mode change, rename or start of a patch
 		if (!$in_commit_log &&
 		    ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
-		    ($line =~ /^rename (?:from|to) \S+\s*$/ ||
+		     $line =~ /^rename (?:from|to) \S+\s*$/ ||
 		     $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/)) {
 			$is_patch = 1;
 		}
-- 
2.17.0.921.gf22659ad46-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] FIXUP checkpatch: improve patch recognition
  2018-05-30 16:51   ` [PATCH] FIXUP checkpatch: improve " Gwendal Grignou
@ 2018-05-30 17:02     ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2018-05-30 17:02 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: linux-kernel

On Wed, 2018-05-30 at 09:51 -0700, Gwendal Grignou wrote:
> Fix syntax error in patch.

https://lkml.org/lkml/2018/5/29/932

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-30 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22  0:38 [PATCH 0/2] scripts: Improve patch recognition Joe Perches
2018-05-22  0:38 ` [PATCH 1/2] checkpatch: " Joe Perches
2018-05-30 16:51   ` [PATCH] FIXUP checkpatch: improve " Gwendal Grignou
2018-05-30 17:02     ` Joe Perches
2018-05-22  0:38 ` [PATCH 2/2] get_maintainer: Improve " Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox