From: Borislav Petkov <petkovbb@googlemail.com>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] scripts/get_maintainer.pl: add support for STDIN:
Date: Wed, 23 Dec 2009 14:55:35 +0100 [thread overview]
Message-ID: <9ea470500912230555k6b72407al730da6361d8aba0f@mail.gmail.com> (raw)
Teach get_maintainer.pl to read a diff from STDIN so that you can do
something like:
git diff | ./scripts/get_maintainer.pl -
and have the Cc: list before writing the commit message.
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
scripts/get_maintainer.pl | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 445e884..80d5a69 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -5,7 +5,7 @@
# Print selected MAINTAINERS information for
# the files modified in a patch or for a file
#
-# usage: perl scripts/get_maintainer.pl [OPTIONS] <patch>
+# usage: perl scripts/get_maintainer.pl [OPTIONS] <patch>|STDIN
# perl scripts/get_maintainer.pl [OPTIONS] -f <file>
#
# Licensed under the terms of the GNU GPL License version 2
@@ -237,7 +237,7 @@ foreach my $file (@ARGV) {
##if $file is a directory and it lacks a trailing slash, add one
if ((-d $file)) {
$file =~ s@([^/])$@$1/@;
- } elsif (!(-f $file)) {
+ } elsif (!(-f $file) && ($file ne '-')) {
die "$P: file '${file}' not found\n";
}
if ($from_filename) {
@@ -255,7 +255,11 @@ foreach my $file (@ARGV) {
} else {
my $file_cnt = @files;
my $lastfile;
- open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
+ if ($file eq '-') {
+ open(PATCH, "<&STDIN");
+ } else {
+ open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
+ }
while (<PATCH>) {
my $patch_line = $_;
if (m/^\+\+\+\s+(\S+)/) {
@@ -422,7 +426,7 @@ sub file_match_pattern {
sub usage {
print <<EOT;
-usage: $P [options] patchfile
+usage: $P [options] patchfile|-
$P [options] -f file|directory
version: $V
--
1.6.5.4
--
Regards/Gruss,
Boris
next reply other threads:[~2009-12-23 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 13:55 Borislav Petkov [this message]
2009-12-23 23:27 ` [PATCH] scripts/get_maintainer.pl: add support to read patch from STDIN Joe Perches
2009-12-24 6:45 ` Borislav Petkov
2009-12-24 6:48 ` Joe Perches
2009-12-24 6:53 ` Borislav Petkov
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=9ea470500912230555k6b72407al730da6361d8aba0f@mail.gmail.com \
--to=petkovbb@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®