lkml.org 
[lkml]   [2019]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] scripts: helper for mailing patches from git to the maintainers
Date
This is a little helper script for mailing patches out of a git
branch to the corresponding maintainers.

Essentially, it scans the touched files, asks get_maintainer.pl
for their maintainers and calls git-send-email for mailing out
the patches.

Syntax:

./scripts/git-send-patch <ref> [<optional git-send-email args>]

Examples:

./scripts/git-send-patch HEAD^
./scripts/git-send-patch linus/master --dry-run

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
scripts/git-send-patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100755 scripts/git-send-patch

diff --git a/scripts/git-send-patch b/scripts/git-send-patch
new file mode 100755
index 0000000..b54790f
--- /dev/null
+++ b/scripts/git-send-patch
@@ -0,0 +1,62 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+[ -x "$GIT" ] || export GIT=git
+[ -d "$KERNELSRC" ] || export KERNELSRC=.
+
+LKML="linux-kernel@vger.kernel.org"
+
+check_ksrc() {
+ if [ -d $KERNELSRC/arch ] && \
+ [ -d $KERNELSRC/block ] && \
+ [ -d $KERNELSRC/init ] && \
+ [ -d $KERNELSRC/kernel ] && \
+ [ -d $KERNELSRC/sound ] && \
+ [ -d $KERNELSRC/drivers ] && \
+ [ -d $KERNELSRC/net ] && \
+ [ -d $KERNELSRC/include ] && \
+ [ -f $KERNELSRC/COPYING ] && \
+ [ -f $KERNELSRC/MAINTAINERS ] && \
+ [ -f $KERNELSRC/CREDITS ] && \
+ [ -f $KERNELSRC/Kconfig ] && \
+ [ -f $KERNELSRC/Makefile ]; then
+ return 0
+ else
+ echo "$0: cant find the kernel source tree. please call me from the topdir" >&2
+ exit 1
+ fi
+}
+
+check_ksrc
+
+get_files() {
+ $GIT diff --name-only "$REF"
+}
+
+get_maintainers() {
+ $KERNELSRC/scripts/get_maintainer.pl --m --l --remove-duplicates `get_files` |
+ grep -v "$LKML" | \
+ grep -E "(maintainer|reviewer|open list)" | \
+ grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*'
+}
+
+construct_params() {
+ echo -n "--to=$LKML "
+ for a in `get_maintainers`; do
+ echo -n "--cc=$a "
+ done
+}
+
+if [ ! "$1" ]; then
+ echo "$0: missing git revision to send out" >&2
+ echo "" >&2
+ echo "for example: 'HEAD^' for sending just the last patch" >&2
+ echo >&2
+ echo "$0 <git-ref> [<extra params for git-send-mail>]"
+ exit 1
+fi
+
+REF="$1"
+shift
+
+$GIT send-email `construct_params` "$REF" "$@"
--
1.9.1
\
 
 \ /
  Last update: 2019-03-07 03:28    [W:0.048 / U:2.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site