Last active
February 25, 2022 14:52
-
-
Save bonzini/cd056d0378d2482fd8553bd1722bc7ec to your computer and use it in GitHub Desktop.
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/sh | |
if test $1 = -n; then | |
ARGS=--dry-run | |
shift | |
else | |
ARGS=--confirm=always | |
fi | |
mboxsplit() { | |
last=$(git mailsplit -d4 -o$1 -b -- -) | |
echo Sending $last thank you messages... | |
} | |
mkdir .mboxsplit || exit | |
trap 'st=$?; rm -rf .mboxsplit; exit $st' 0 INT TERM | |
patchew -s https://patchew.org search -r "$*" | jq -r ' | |
def address: if .name then "\(.name) <\(.address)>" else .address end; | |
map({ | |
"subject": .subject, | |
"message_id": .message_id, | |
"sender": .sender | address, | |
"recipients": .recipients | map(select(.name != "Paolo Bonzini")) | map(address) | join(", "), | |
}) | map([ | |
"From - Mon Sep 17 00:00:00 2001", | |
"From: Paolo Bonzini <[email protected]>", | |
"To: \(.sender)", | |
"Cc: \(.recipients)", | |
"Subject: Re: \(.subject)", | |
"In-reply-to: <\(.message_id)>", "", | |
"Queued, thanks.", "", | |
"Paolo", "", "" | |
] | join("\n")) | join("")' | mboxsplit .mboxsplit | |
sleep 1 | |
exec git send-email --no-thread --to '' $ARGS .mboxsplit/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment