Skip to content

added sendto script#1

Merged
nickdesaulniers merged 1 commit intoClangBuiltLinux:mainfrom
JustinStitt:sendto
Jul 14, 2022
Merged

added sendto script#1
nickdesaulniers merged 1 commit intoClangBuiltLinux:mainfrom
JustinStitt:sendto

Conversation

@JustinStitt
Copy link
Copy Markdown
Collaborator

Use Case:

  • Helps streamline the get_maintainer -> git send-email workflow by auto-running ./scripts/get_maintainer.pl and formatting the output to stdout. This output has, hopefully, intelligently chosen the appropriate --to and --cc flag for each recipient based on their maintainer status (also includes mailing lists).

Installation:

put in /usr/bin/sendto

Usage:

$ sendto <patch_file>

Example Output:

git send-email \
--to "Petr Mladek <pmladek@suse.com>" \
--to "Steven Rostedt <rostedt@goodmis.org>" \
--to "Sergey Senozhatsky <senozhatsky@chromium.org>" \
--cc "Andy Shevchenko <andriy.shevchenko@linux.intel.com>" \
--cc "Rasmus Villemoes <linux@rasmusvillemoes.dk>" \
--cc "Nathan Chancellor <nathan@kernel.org>" \
--cc "Nick Desaulniers <ndesaulniers@google.com>" \
--cc "Tom Rix <trix@redhat.com>" \
--cc "linux-kernel@vger.kernel.org" \
--cc "llvm@lists.linux.dev" v2-0002-lib-test_printf.c-fix-clang-Wformat-warnings.patch

Signed-off-by: Justin Stitt justinstitt@google.com

Signed-off-by: Justin Stitt <justinstitt@google.com>
@paulmenzel
Copy link
Copy Markdown

I’d use imperative mood in the commit message summary: Add sendto scripts.

But, you can integrate Linux’ scripts/get_maintainer.pl directly. In ~/.gitconfig:

[sendemail.linux]
        tocmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol"
        cccmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom"

Then git send-email --identity linux 0001-X.patch.

@nickdesaulniers
Copy link
Copy Markdown
Member

@JustinStitt thanks for the patch, can you test out @paulmenzel 's suggestion and provide comparisons of the two approaches?

@JustinStitt
Copy link
Copy Markdown
Collaborator Author

@nickdesaulniers I tried both approaches.

tl;dr: Paul's approach uses --to for any humans and --cc for any mailing list or tracker. My script only uses --to for maintainers specifically, --cc for everything else. Paul's method runs ~100-200ms faster.

Paul's approach:

From: Justin Stitt <justinstitt@google.com>
To: Gregory Greenman <gregory.greenman@intel.com>,
        Kalle Valo <kvalo@kernel.org>,
        "David S. Miller" <davem@davemloft.net>,
        Eric Dumazet <edumazet@google.com>,
        Jakub Kicinski <kuba@kernel.org>,
        Paolo Abeni <pabeni@redhat.com>,
        Nathan Chancellor <nathan@kernel.org>,
        Nick Desaulniers <ndesaulniers@google.com>,
        Tom Rix <trix@redhat.com>
Cc: Justin Stitt <justinstitt@google.com>,
        linux-wireless@vger.kernel.org,
        netdev@vger.kernel.org,
        linux-kernel@vger.kernel.org,
        llvm@lists.linux.dev

My Approach:

From: Justin Stitt <justinstitt@google.com>
To: Kalle Valo <kvalo@kernel.org>,
        "David S . Miller" <davem@davemloft.net>,
        Eric Dumazet <edumazet@google.com>,
        Jakub Kicinski <kuba@kernel.org>,
        Paolo Abeni <pabeni@redhat.com>
Cc: Gregory Greenman <gregory.greenman@intel.com>,
        Nathan Chancellor <nathan@kernel.org>,
        Nick Desaulniers <ndesaulniers@google.com>,
        Tom Rix <trix@redhat.com>,
        Luca Coelho <luciano.coelho@intel.com>,
        Johannes Berg <johannes.berg@intel.com>,
        Avraham Stern <avraham.stern@intel.com>,
        Miri Korenblit <miriam.rachel.korenblit@intel.com>,
        Justin Stitt <justinstitt@google.com>,
        linux-wireless@vger.kernel.org,
        netdev@vger.kernel.org,
        linux-kernel@vger.kernel.org,
        llvm@lists.linux.dev

Output from get_maintainer.pl for a random patch:

Gregory Greenman <gregory.greenman@intel.com> (supporter:INTEL WIRELESS WIFI LINK (iwlwifi))
Kalle Valo <kvalo@kernel.org> (maintainer:NETWORKING DRIVERS (WIRELESS))
"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING DRIVERS)
Eric Dumazet <edumazet@google.com> (maintainer:NETWORKING DRIVERS)
Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING DRIVERS,commit_signer:1/9=11%)
Paolo Abeni <pabeni@redhat.com> (maintainer:NETWORKING DRIVERS)
Nathan Chancellor <nathan@kernel.org> (supporter:CLANG/LLVM BUILD SUPPORT,commit_signer:1/9=11%,authored:1/9=11%,removed_lines:2/33=6%)
Nick Desaulniers <ndesaulniers@google.com> (supporter:CLANG/LLVM BUILD SUPPORT)
Tom Rix <trix@redhat.com> (reviewer:CLANG/LLVM BUILD SUPPORT)
Luca Coelho <luciano.coelho@intel.com> (commit_signer:14/9=100%)
Johannes Berg <johannes.berg@intel.com> (commit_signer:3/9=33%,authored:3/9=33%,added_lines:14/104=13%,removed_lines:14/33=42%)
Avraham Stern <avraham.stern@intel.com> (commit_signer:3/9=33%,authored:3/9=33%,added_lines:85/104=82%,removed_lines:14/33=42%)
Miri Korenblit <miriam.rachel.korenblit@intel.com> (authored:1/9=11%)
Justin Stitt <justinstitt@google.com> (authored:1/9=11%,removed_lines:2/33=6%)
linux-wireless@vger.kernel.org (open list:INTEL WIRELESS WIFI LINK (iwlwifi))
netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
linux-kernel@vger.kernel.org (open list)
llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT)

@nickdesaulniers nickdesaulniers merged commit 0035224 into ClangBuiltLinux:main Jul 14, 2022
@paulmenzel
Copy link
Copy Markdown

Why not improve get_maintainers.pl instead?

@JustinStitt
Copy link
Copy Markdown
Collaborator Author

Why not improve get_maintainers.pl instead?

Making a slight modification to explicitly exclude reviewers produces a less bloated --to section. This works great and may be what I start using, the only problem is that if I want to manually change or add a recipient it requires more work. I do like how my script outputs a copy/pasteable and thus modifiable git send-email hunk.

tocmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --m --nol --nor --nos"
cccmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom --l"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants