From: Peter Collingbourne <pcc@google.com>
To: Joe Perches <joe@perches.com>
Cc: Peter Collingbourne <pcc@google.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] get_maintainer.pl: support running from non-top-level dir
Date: Mon, 13 Sep 2021 16:34:35 -0700 [thread overview]
Message-ID: <20210913233435.24585-1-pcc@google.com> (raw)
My workflow usually involves running scripts from a subdirectory of the
kernel source tree. This fails with get_maintainer.pl because it assumes
that it runs from the top level. Fix this assumption by setting $lk_path
appropriately based on a check of $0 similar to what is in checkpatch.pl.
This also requires fixing the VCS available checks to also check $lk_path.
Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I1ceda4106b3f90d8608fc7911079d2eda1c1a0c6
---
scripts/get_maintainer.pl | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 2075db0c08b8..47474cb85ea7 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -114,7 +114,7 @@ my %VCS_cmds;
my %VCS_cmds_git = (
"execute_cmd" => \&git_execute_cmd,
- "available" => '(which("git") ne "") && (-e ".git")',
+ "available" => '(which("git") ne "") && (-e "${lk_path}.git")',
"find_signers_cmd" =>
"git log --no-color --follow --since=\$email_git_since " .
'--numstat --no-merges ' .
@@ -154,7 +154,7 @@ my %VCS_cmds_git = (
my %VCS_cmds_hg = (
"execute_cmd" => \&hg_execute_cmd,
- "available" => '(which("hg") ne "") && (-d ".hg")',
+ "available" => '(which("hg") ne "") && (-d "${lk_path}.hg")',
"find_signers_cmd" =>
"hg log --date=\$email_hg_since " .
"--template='HgCommit: {node}\\n" .
@@ -333,6 +333,10 @@ if ($email &&
die "$P: Please select at least 1 email option\n";
}
+if ($0 =~ m@(.*)/scripts/[^/]*$@ && top_of_kernel_tree($1)) {
+ $lk_path = "$1/";
+}
+
if ($tree && !top_of_kernel_tree($lk_path)) {
die "$P: The current directory does not appear to be "
. "a linux kernel source tree.\n";
--
2.33.0.309.g3052b89438-goog
next reply other threads:[~2021-09-13 23:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 23:34 Peter Collingbourne [this message]
2022-02-23 22:31 ` [PATCH] get_maintainer.pl: support running from non-top-level dir Peter Collingbourne
2022-11-04 16:50 ` Peter Collingbourne
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=20210913233435.24585-1-pcc@google.com \
--to=pcc@google.com \
--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