Created
February 9, 2026 19:45
-
-
Save kcxt/2bf9b7410fea3f841615beea5b593aaf to your computer and use it in GitHub Desktop.
Install as cocci_to and create a symlink to cocci_cc, pass --to-cmd=cocci_to --cc-cmd=cocci_cc to get-send-email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # cocci_cc - send cover letter to all mailing lists referenced in a patch series | |
| # intended to be used as 'git send-email --cc-cmd=cocci_cc ...' | |
| # done by Wolfram Sang in 2012-14, version 20140204 - WTFPLv2 | |
| shopt -s extglob | |
| cd $(git rev-parse --show-toplevel) > /dev/null | |
| patch="$1" | |
| cmd="scripts/get_maintainer.pl --no-rolestats" | |
| to_cmd="$cmd --no-l" | |
| cc_cmd="$cmd -l --no-m --no-r" | |
| function get_addrs() { | |
| get_cmd="$1" | |
| #echo "Using cmd: $get_cmd" >&2 | |
| $get_cmd $patch | grep -v "linux-kernel@vger.kernel.org" 2>/dev/null | sort -u | |
| } | |
| to_addrs="$(get_addrs "$to_cmd")" | |
| if [ "$(basename "$0")" = "cocci_cc" ]; then | |
| cc_addrs="$(get_addrs "$cc_cmd")" | |
| # Print only emails that are unique to the CC list | |
| # prevent someone showing up in TO and CC | |
| #echo -e "CC addrs:\n$cc_addrs\n" | |
| #echo -e "TO addrs:\n$to_addrs\n\n" | |
| comm -32 <(echo -e "$cc_addrs") <(echo -e "$to_addrs") | |
| else | |
| echo -e "$to_addrs" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment