summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-06-05 01:50:43 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2020-06-05 04:06:25 +0200
commitc7f574d0e9f9e8c3655b6bb06e69e37d341956d3 (patch)
tree95f43c140ae4de5e4d7be2764b7359d77bc30b80 /scripts
parentcheckpatch: disallow --git and --file/--fix (diff)
downloadlinux-c7f574d0e9f9e8c3655b6bb06e69e37d341956d3.tar.xz
linux-c7f574d0e9f9e8c3655b6bb06e69e37d341956d3.zip
checkpatch: use patch subject when reading from stdin
While "git am" can apply an mbox file containing multiple patches (e.g. as created by b4[1], or a patch bundle downloaded from patchwork), checkpatch does not have proper support for that. When operating on an mbox, checkpatch will merge all detected tags, and complain falsely about duplicates: WARNING: Duplicate signature As modifying checkpatch to reset state in between each patch is a lot of work, a simple solution is splitting the mbox into individual patches, and invoking checkpatch for each of them. Fortunately checkpatch can read a patch from stdin, so the classic "formail" tool can be used to split the mbox, and pipe all individual patches to checkpatch: formail -s scripts/checkpatch.pl < my-mbox However, when reading a patch file from standard input, checkpatch calls it "Your patch", and reports its state as: Your patch has style problems, please review. or: Your patch has no obvious style problems and is ready for submission. Hence it can be difficult to identify which patches need to be reviewed and improved. Fix this by replacing "Your patch" by (the first line of) the email subject, if present. Note that "git mailsplit" can also be used to split an mbox, but it will create individual files for each patch, thus requiring cleanup afterwards. Formail does not have this disadvantage. [1] https://git.kernel.org/pub/scm/utils/b4/b4.git [joe@perches.com: reduce cpu usage] Link: http://lkml.kernel.org/r/c9d89bb24c7414142414c60371e210fdcf4617d2.camel@perches.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Joe Perches <joe@perches.com> Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: http://lkml.kernel.org/r/20200505132613.17452-1-geert+renesas@glider.be Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f1e925d36b26..10a0e035a787 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1062,6 +1062,7 @@ for my $filename (@ARGV) {
while (<$FILE>) {
chomp;
push(@rawlines, $_);
+ $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
}
close($FILE);