mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] scripts: Introduce a helper script for git send-email
@ 2022-06-17 18:32 Mario Limonciello
  2022-06-17 18:32 ` [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh Mario Limonciello
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Limonciello @ 2022-06-17 18:32 UTC (permalink / raw)
  To: mario.limonciello, linux-kernel; +Cc: Joe Perches

Kernel documentation suggests to use scripts/get_maintainer.pl to
find maintainers, but this can be a tedious process especially when
contributing to new subsystems.  To make the process easier, introduce
a helper script that can be used with `--to-cmd` and `--cc-cmd` with
`git send-email`.

When this script is launched directly (./scripts/git-send-email.sh) it
will emit usage instructions.  This is based off of scripts posted by
Joe Perches.

Suggested-by: Joe Perches <joe@perches.com>
Link: https://lore.kernel.org/lkml/1473862411.32273.25.camel@perches.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 scripts/git-send-email-cc.sh |  1 +
 scripts/git-send-email-to.sh |  1 +
 scripts/git-send-email.sh    | 37 ++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 120000 scripts/git-send-email-cc.sh
 create mode 120000 scripts/git-send-email-to.sh
 create mode 100755 scripts/git-send-email.sh

diff --git a/scripts/git-send-email-cc.sh b/scripts/git-send-email-cc.sh
new file mode 120000
index 000000000000..ecb7bcc91077
--- /dev/null
+++ b/scripts/git-send-email-cc.sh
@@ -0,0 +1 @@
+git-send-email.sh
\ No newline at end of file
diff --git a/scripts/git-send-email-to.sh b/scripts/git-send-email-to.sh
new file mode 120000
index 000000000000..ecb7bcc91077
--- /dev/null
+++ b/scripts/git-send-email-to.sh
@@ -0,0 +1 @@
+git-send-email.sh
\ No newline at end of file
diff --git a/scripts/git-send-email.sh b/scripts/git-send-email.sh
new file mode 100755
index 000000000000..89760d50c124
--- /dev/null
+++ b/scripts/git-send-email.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Helper script for git send-email to determine who to send email to.
+# Uses scripts/get_maintainer.pl to parse MAINTAINERS
+#
+
+usage()
+{
+	echo "To use this script add these lines to your gitconfig:"
+	printf "[sendemail]\n"
+	printf "\t    cccmd = ./scripts/git-send-email-cc.sh\n"
+	printf "\t    tocmd = ./scripts/git-send-email-to.sh\n"
+	exit 1
+}
+
+patch="$1"
+opts="--nogit --nogit-fallback --norolestats"
+if [ $(basename "$0") = "git-send-email.sh" ]; then
+	usage
+elif [ $(basename "$0") = "git-send-email-to.sh" ]; then
+	opts="$opts --pattern-depth=1"
+	maint_opts="--nol"
+fi
+#Handle cover letters - Add maintainers for all other patches in the directory
+if [[ $(basename "$patch") =~ ^0000- ]] ; then
+	./scripts/get_maintainer.pl --nom $opts  $(dirname "$patch")/*.patch
+#Handle patches
+else
+	maint=$(./scripts/get_maintainer.pl $maint_opts $opts "$patch")
+	if [ "$maint" = "" ] && [ "$maint_opts" ]; then
+		echo "linux-kernel@vger.kernel.org"
+	else
+		echo "$maint"
+	fi
+fi
+
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh
  2022-06-17 18:32 [PATCH 1/2] scripts: Introduce a helper script for git send-email Mario Limonciello
@ 2022-06-17 18:32 ` Mario Limonciello
  2022-06-17 18:50   ` Jonathan Corbet
  2022-06-19  3:43   ` Bagas Sanjaya
  0 siblings, 2 replies; 6+ messages in thread
From: Mario Limonciello @ 2022-06-17 18:32 UTC (permalink / raw)
  To: mario.limonciello, linux-kernel; +Cc: Joe Perches, Jonathan Corbet, linux-doc

In the part of the documentation explaining about identifying maintainers
mention the `scripts/git-send-email.sh` helper script.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 Documentation/process/submitting-patches.rst | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/process/submitting-patches.rst b/Documentation/process/submitting-patches.rst
index a1cb6280fbcf..039deed14c49 100644
--- a/Documentation/process/submitting-patches.rst
+++ b/Documentation/process/submitting-patches.rst
@@ -225,7 +225,10 @@ Select the recipients for your patch
 ------------------------------------
 
 You should always copy the appropriate subsystem maintainer(s) on any patch
-to code that they maintain; look through the MAINTAINERS file and the
+to code that they maintain. A helper script is available in
+./scripts/git-send-email.sh that can be used with git-send-email to automatically
+findd the appropriate recipients for a patch.
+Alternatively you may look through the MAINTAINERS file manually and the
 source code revision history to see who those maintainers are.  The
 script scripts/get_maintainer.pl can be very useful at this step (pass paths to
 your patches as arguments to scripts/get_maintainer.pl).  If you cannot find a
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh
  2022-06-17 18:32 ` [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh Mario Limonciello
@ 2022-06-17 18:50   ` Jonathan Corbet
  2022-06-17 18:54     ` Limonciello, Mario
  2022-06-19  3:43   ` Bagas Sanjaya
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Corbet @ 2022-06-17 18:50 UTC (permalink / raw)
  To: Mario Limonciello, mario.limonciello, linux-kernel; +Cc: Joe Perches, linux-doc

Mario Limonciello <mario.limonciello@amd.com> writes:

> In the part of the documentation explaining about identifying maintainers
> mention the `scripts/git-send-email.sh` helper script.
>
> Suggested-by: Joe Perches <joe@perches.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  Documentation/process/submitting-patches.rst | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

So if you used this script to send this series, I can already see a
problem; I have a 2/2 patch without having seen the script that you are
talking about.  Bringing in maintainers partway through a patch series
like this is not the best way to go.

> diff --git a/Documentation/process/submitting-patches.rst b/Documentation/process/submitting-patches.rst
> index a1cb6280fbcf..039deed14c49 100644
> --- a/Documentation/process/submitting-patches.rst
> +++ b/Documentation/process/submitting-patches.rst
> @@ -225,7 +225,10 @@ Select the recipients for your patch
>  ------------------------------------
>  
>  You should always copy the appropriate subsystem maintainer(s) on any patch
> -to code that they maintain; look through the MAINTAINERS file and the
> +to code that they maintain. A helper script is available in
> +./scripts/git-send-email.sh that can be used with git-send-email to automatically
> +findd the appropriate recipients for a patch.

Please run a spelling checker on your documentation changes.

> +Alternatively you may look through the MAINTAINERS file manually and the
>  source code revision history to see who those maintainers are.  The
>  script scripts/get_maintainer.pl can be very useful at this step (pass paths to
>  your patches as arguments to scripts/get_maintainer.pl).  If you cannot find a
> -- 
> 2.25.1

Thanks,

jon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh
  2022-06-17 18:50   ` Jonathan Corbet
@ 2022-06-17 18:54     ` Limonciello, Mario
  2022-06-17 19:06       ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Limonciello, Mario @ 2022-06-17 18:54 UTC (permalink / raw)
  To: Jonathan Corbet, linux-kernel; +Cc: Joe Perches, linux-doc

[Public]



> -----Original Message-----
> From: Jonathan Corbet <corbet@lwn.net>
> Sent: Friday, June 17, 2022 13:51
> To: Limonciello, Mario <Mario.Limonciello@amd.com>; Limonciello, Mario
> <Mario.Limonciello@amd.com>; linux-kernel@vger.kernel.org
> Cc: Joe Perches <joe@perches.com>; linux-doc@vger.kernel.org
> Subject: Re: [PATCH 2/2] Documentation: Add a blurb about using scripts/git-
> send-email.sh
> 
> Mario Limonciello <mario.limonciello@amd.com> writes:
> 
> > In the part of the documentation explaining about identifying maintainers
> > mention the `scripts/git-send-email.sh` helper script.
> >
> > Suggested-by: Joe Perches <joe@perches.com>
> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > ---
> >  Documentation/process/submitting-patches.rst | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> So if you used this script to send this series, I can already see a
> problem; I have a 2/2 patch without having seen the script that you are
> talking about.  Bringing in maintainers partway through a patch series
> like this is not the best way to go.

Hmm; It's very situational.  If you're working in a single subsystem then the
authoritative folks will be the maintainers in that subsystem, but perhaps
folks will also be interested in the other patches even if they're not authoritative.
This becomes particularly relevant when the patches will need to go through
one tree or the other. 

In this particular case I'd actually think folding the script into the Documentation
patch makes the most sense.

For now; here's the direct link to this script patch:
https://lore.kernel.org/linux-kernel/20220617183215.25917-1-mario.limonciello@amd.com/T/#m163ce735a6422a037bb4f12009ebbd9db6985814

> 
> > diff --git a/Documentation/process/submitting-patches.rst
> b/Documentation/process/submitting-patches.rst
> > index a1cb6280fbcf..039deed14c49 100644
> > --- a/Documentation/process/submitting-patches.rst
> > +++ b/Documentation/process/submitting-patches.rst
> > @@ -225,7 +225,10 @@ Select the recipients for your patch
> >  ------------------------------------
> >
> >  You should always copy the appropriate subsystem maintainer(s) on any
> patch
> > -to code that they maintain; look through the MAINTAINERS file and the
> > +to code that they maintain. A helper script is available in
> > +./scripts/git-send-email.sh that can be used with git-send-email to
> automatically
> > +findd the appropriate recipients for a patch.
> 
> Please run a spelling checker on your documentation changes.

Oh whoops; sorry.  I'm a bit surprised ./scripts/checkpatch didn't catch that.

> 
> > +Alternatively you may look through the MAINTAINERS file manually and
> the
> >  source code revision history to see who those maintainers are.  The
> >  script scripts/get_maintainer.pl can be very useful at this step (pass paths
> to
> >  your patches as arguments to scripts/get_maintainer.pl).  If you cannot
> find a
> > --
> > 2.25.1
> 
> Thanks,
> 
> jon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh
  2022-06-17 18:54     ` Limonciello, Mario
@ 2022-06-17 19:06       ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2022-06-17 19:06 UTC (permalink / raw)
  To: Limonciello, Mario, Jonathan Corbet, linux-kernel; +Cc: linux-doc

On Fri, 2022-06-17 at 18:54 +0000, Limonciello, Mario wrote:
> > -----Original Message-----
> > From: Jonathan Corbet <corbet@lwn.net>
[]
> > > diff --git a/Documentation/process/submitting-patches.rst
[]
> > > @@ -225,7 +225,10 @@ Select the recipients for your patch
> > >  ------------------------------------
> > > 
> > >  You should always copy the appropriate subsystem maintainer(s) on any patch
> > > -to code that they maintain; look through the MAINTAINERS file and the
> > > +to code that they maintain. A helper script is available in
> > > +./scripts/git-send-email.sh that can be used with git-send-email to automatically
> > > +findd the appropriate recipients for a patch.
> > 
> > Please run a spelling checker on your documentation changes.
> Oh whoops; sorry.  I'm a bit surprised ./scripts/checkpatch didn't catch that.

checkpatch (and codespell) relies on a list of common misspellings.

You could add the misspelling to scripts/spelling.txt or maybe
add --codespell to the checkpatch invocation.

But adding --codespell here didn't find that typo either as
the codespell dictionary list doesn't include "findd".


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh
  2022-06-17 18:32 ` [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh Mario Limonciello
  2022-06-17 18:50   ` Jonathan Corbet
@ 2022-06-19  3:43   ` Bagas Sanjaya
  1 sibling, 0 replies; 6+ messages in thread
From: Bagas Sanjaya @ 2022-06-19  3:43 UTC (permalink / raw)
  To: Mario Limonciello, linux-kernel; +Cc: Joe Perches, Jonathan Corbet, linux-doc

On 6/18/22 01:32, Mario Limonciello wrote:
>  You should always copy the appropriate subsystem maintainer(s) on any patch
> -to code that they maintain; look through the MAINTAINERS file and the
> +to code that they maintain. A helper script is available in
> +./scripts/git-send-email.sh that can be used with git-send-email to automatically
> +findd the appropriate recipients for a patch.
> +Alternatively you may look through the MAINTAINERS file manually and the
>  source code revision history to see who those maintainers are.  The
>  script scripts/get_maintainer.pl can be very useful at this step (pass paths to
>  your patches as arguments to scripts/get_maintainer.pl).  If you cannot find a

s/findd/find/

Otherwise looks OK.

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-19  3:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 18:32 [PATCH 1/2] scripts: Introduce a helper script for git send-email Mario Limonciello
2022-06-17 18:32 ` [PATCH 2/2] Documentation: Add a blurb about using scripts/git-send-email.sh Mario Limonciello
2022-06-17 18:50   ` Jonathan Corbet
2022-06-17 18:54     ` Limonciello, Mario
2022-06-17 19:06       ` Joe Perches
2022-06-19  3:43   ` Bagas Sanjaya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome