citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit cdf3a6cf5d6caa435b64263e63bb8d6891bb9cff
parent 1018b71c4cc57ed4f65454efaa6cfc9c98417bef
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 11 Sep 2023 11:00:43 -0700

mail-prpatch-insert updates

Diffstat:
Mbin/mail-prpatch-insert | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/bin/mail-prpatch-insert b/bin/mail-prpatch-insert @@ -3,7 +3,7 @@ set -e function new_msgid() { - echo "<$(sha256sum "$file" | awk '{ print $1 }')-$(date +%s)>" + echo "<$(sha256sum "$1" | awk '{ print $1 }')-$(date +%s)>" } TO="jb55@jb55.com" @@ -11,6 +11,13 @@ PRPATCH="$HOME/var/prpatch" MBOX="$PRPATCH/out.mbox" PATCHES="$PRPATCH/out" +function build_coverletter() { + <"$1" awk '/^$/ {exit} {print}' > "$PRPATCH"/header + <"$PRPATCH/mail" awk 'BEGIN {print_it=0;} skip > 0 {skip -= 1; next;} /^----==_mimepart/ {print_it=!print_it;skip=3;next;} print_it==1 {print;}' | + cat "$PRPATCH/header" - | + sed 's,PATCH 1,PATCH 0,' > "$PATCHES/0000" +} + rm -rf "$PRPATCH" mkdir -p "$PATCHES" mail="$(cat -)" @@ -22,13 +29,14 @@ replyto="$(grep -i '^reply-to:' <<<"$mail" | cut -d":" -f2- | tr -d '\n' || :)" echo "$mail" > "$PRPATCH/mail" <<<"$mail" mail-prpatch > "$MBOX" -#sed -i"" '/^Subject:/ {N; s/\n / /}' "$MBOX" +# pull out the cover letter git mailsplit -o"$PATCHES" "$MBOX" -file="$PATCHES"/0001 +$(build_coverletter "$PATCHES/0001") -msgid=$(new_msgid) +file="$PATCHES"/0000 +msgid=$(new_msgid "$file") threadid=$msgid for file in "$PATCHES/"* do @@ -53,6 +61,10 @@ do sed -i"" "s,\[PATCH,\[PATCH $target," "$file" fi + if [[ "$prlink" =~ "damus-io" ]]; then + TO="patches@damus.io" + fi + sed -i"" "1 a To: $TO" "$file" sed -i"" "1 a Message-ID: $msgid" "$file" @@ -62,5 +74,5 @@ do notmuch insert +inbox < "$file" - msgid=$(new_msgid) + msgid=$(new_msgid "$file") done