public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "L. Alberto Giménez" <agimenez@sysvalve.es>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Mickler <florian@mickler.org>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Wolfram Sang <w.sang@pengutronix.de>
Subject: [PATCH] get_maintainer.pl: Allow "K:" pattern tests to match non-patch text
Date: Tue, 25 Jan 2011 06:08:49 -0800	[thread overview]
Message-ID: <1295964529.15568.11.camel@Joe-Laptop> (raw)
In-Reply-To: <20110125002555.GB13167@bart.evergreen.loc>

Extend the usage of the K section in the MAINTAINERS file to support matching
regular expressions to any arbitrary text that may precede the patch itself.
For example, the commit message or mail headers generated by git-format-patch.

Original-patch-by: L. Alberto Giménez <agimenez@sysvalve.es>
Signed-off-by: Joe Perches <joe@perches.com>

---

> On Tue, 2011-01-25 at 01:25 +0100, L. Alberto Giménez wrote:
> feel free to fix the patch.

 scripts/get_maintainer.pl |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 139e0ff..d29a8d7 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -420,6 +420,14 @@ foreach my $file (@ARGV) {
 
 	open(my $patch, "< $file")
 	    or die "$P: Can't open $file: $!\n";
+
+	# We can check arbitrary information before the patch
+	# like the commit message, mail headers, etc...
+	# This allows us to match arbitrary keywords against any part
+	# of a git format-patch generated file (subject tags, etc...)
+
+	my $patch_prefix = "";			#Parsing the intro
+
 	while (<$patch>) {
 	    my $patch_line = $_;
 	    if (m/^\+\+\+\s+(\S+)/) {
@@ -428,13 +436,14 @@ foreach my $file (@ARGV) {
 		$filename =~ s@\n@@;
 		$lastfile = $filename;
 		push(@files, $filename);
+		$patch_prefix = "^[+-].*";	#Now parsing the actual patch
 	    } elsif (m/^\@\@ -(\d+),(\d+)/) {
 		if ($email_git_blame) {
 		    push(@range, "$lastfile:$1:$2");
 		}
 	    } elsif ($keywords) {
 		foreach my $line (keys %keyword_hash) {
-		    if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) {
+		    if ($patch_line =~ m/${patch_prefix}$keyword_hash{$line}/x) {
 			push(@keyword_tvi, $line);
 		    }
 		}



  reply	other threads:[~2011-01-25 14:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 23:32 [PATCH] get_maintainer.pl: Add support to match arbitrary text L. Alberto Giménez
2011-01-24 23:53 ` Joe Perches
2011-01-25  0:25   ` L. Alberto Giménez
2011-01-25 14:08     ` Joe Perches [this message]
2011-01-25 18:44       ` [PATCH] get_maintainer.pl: Allow "K:" pattern tests to match non-patch text L. Alberto Giménez
2011-01-25 18:58         ` Joe Perches
2011-01-26 12:23           ` "L. Alberto Giménez"
2011-01-25 14:23 ` [PATCH] get_maintainer.pl: Add support to match arbitrary text Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295964529.15568.11.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=agimenez@sysvalve.es \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=florian@mickler.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=w.sang@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox