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

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