From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753149Ab1AXXcr (ORCPT ); Mon, 24 Jan 2011 18:32:47 -0500 Received: from 232.Red-88-26-245.staticIP.rima-tde.net ([88.26.245.232]:56359 "HELO sysvalve.homelinux.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751915Ab1AXXcq (ORCPT ); Mon, 24 Jan 2011 18:32:46 -0500 From: =?UTF-8?q?L=2E=20Alberto=20Gim=C3=A9nez?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?L=2E=20Alberto=20Gim=C3=A9nez?= , Andrew Morton , Joe Perches , "David S. Miller" , Florian Mickler , Stephen Hemminger , Wolfram Sang Subject: [PATCH] get_maintainer.pl: Add support to match arbitrary text Date: Tue, 25 Jan 2011 00:32:29 +0100 Message-Id: <1295911951-12615-1-git-send-email-agimenez@sysvalve.es> X-Mailer: git-send-email 1.7.4.rc0.5.gf2665 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend the usage of the K section in the MAINTAINERS file to support matching regular expressions with the content that precedes the patch (delimited by three dashes "---"). The change enables the get_maintainer.pl script to get maintainers based on arbitrary text that may precede the patch itself (for example, the commit message or mail headers generated by git-format-patch) Thanks to Jesper Juhl to point me that trivial patches should be CC'd to Jiri. The idea is that the get_maintainer.pl can detect such situations and add the additional email addresses and let the MAINTAINERS file handle who should get copies of what. Signed-off-by: L. Alberto Giménez --- MAINTAINERS | 1 + scripts/get_maintainer.pl | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index cf0f3a5..c1e33ac 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6145,6 +6145,7 @@ TRIVIAL PATCHES M: Jiri Kosina T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git S: Maintained +K: ^Subject:.*\[(?i)trivial\].* TTY LAYER M: Greg Kroah-Hartman diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 139e0ff..63d4d90 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -420,6 +420,11 @@ foreach my $file (@ARGV) { open(my $patch, "< $file") or die "$P: Can't open $file: $!\n"; + + # We can add arbitrary information before the patch itself (commit message, + # mail headers,... This allows us to match arbitrary keywords agains any + # part of a git-format-patch generated file (subject tags, etc...) + my $in_patch = 0; while (<$patch>) { my $patch_line = $_; if (m/^\+\+\+\s+(\S+)/) { @@ -432,9 +437,14 @@ foreach my $file (@ARGV) { if ($email_git_blame) { push(@range, "$lastfile:$1:$2"); } + } elsif (not $in_patch and m/^---/) { + # enter "patch area": keywords matched only on changed lines + $in_patch = 1; } elsif ($keywords) { foreach my $line (keys %keyword_hash) { - if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) { + my $change_hook = $in_patch ? "^[+-].*" : ""; + + if ($patch_line =~ m/^${change_hook}$keyword_hash{$line}/x) { push(@keyword_tvi, $line); } } -- 1.7.4.rc0.5.gf2665