This keeps a track of existing CCs in the patches and adds them all to the intriduction e-mail CC if they were present. This also introduces X-Cover-Cc header to keep track of those (though it's never actually sent as it's substituted in for the introduction, then removed for subsequent patches)
Issue was raised here: https://lore.kernel.org/ksummit/[email protected]/ and this brings (rough) feature parity on this front with git send-email Signed-off-by: John 'Warthog9' Hawley (VMware) <[email protected]> --- quilt/mail.in | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/quilt/mail.in b/quilt/mail.in index b2cbe5a..b174928 100644 --- a/quilt/mail.in +++ b/quilt/mail.in @@ -59,6 +59,10 @@ first, and a last patch name of \`-' denotes the last patch in the series. --to, --cc, --bcc Append a recipient to the To, Cc, or Bcc header. +--all-cc-cover + Find all Cc's in the patches and also include them in the Cc on + the cover letter only. + --charset Specify a particular message encoding on systems which don't use UTF-8 or ISO-8859-15. This character encoding must match the one @@ -146,6 +150,17 @@ process_mail() cat > $tmpfile + grep -q "^X-Cover-Cc" $tmpfile + xcc_status=$? + if [ "${xcc_status}" = "0" ] + then + sed -i -e '/^Cc:/d' -e 's/^X-Cover-Cc:/Cc:/' $tmpfile + fi + + local tmp="$( cat $tmpfile | $QUILT_DIR/scripts/edmail --charset $opt_charset \ + --remove-empty-headers Cc )" + echo "${tmp}" > $tmpfile + set -- $($QUILT_DIR/scripts/edmail --charset $opt_charset \ --extract-recipients To \ --extract-recipients Cc \ @@ -165,6 +180,12 @@ process_mail() sed -e 's/^From />From /' $tmpfile echo fi + + if [ "${xcc_status}" = "0" ] + then + sed -i '/^X-Cover-Cc:/d' $introduction + fi + rm -f $tmpfile } @@ -181,6 +202,7 @@ join_lines() options=`getopt -o m:M:h \ --long from:,to:,cc:,bcc:,subject: \ + --long all-cc-cover, \ --long send,mbox:,charset:,sender: \ --long prefix:,reply-to:,signature: -- "$@"` @@ -231,6 +253,9 @@ do --bcc) opt_bcc[${#opt_bcc[@]}]=$2 shift 2 ;; + --all-cc-cover) + opt_all_cc_cover=1 + shift ;; --subject) opt_subject=$2 shift 2 ;; @@ -467,8 +492,24 @@ $"Unable to extract a subject header from %s\n" "$(print_patch "$patch")" >&2 exit 1 fi subjects[${#subjects[@]}]="$patch"$'\t'"$subject" + # find al the CC lines for introduction + xccs="$( echo "${xccs} +$( cat_file "${patch_file}" | grep "^Cc: " | sed -e 's/^Cc:[ \t]*//' )" | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | uniq | grep -v "^$" )" done +cover_cc=("${opt_cc[@]}") +if [ "${opt_all_cc_cover}" = "1" ] +then + xccs="$( echo "$(IFS=" +";echo "${cover_cc[*]}") +${xccs}" | uniq | grep -v "^$" )" + cover_cc=() + for cc in ${xccs} + do + cover_cc+=("${cc}") + done +fi + dup_subjects=( $( printf "%s\n" "${subjects[@]}" \ | sort -k2 \ @@ -515,6 +556,7 @@ introduction="$(gen_tempfile)" From: ${opt_from:-$opt_sender} To: $(IFS=,; echo "${opt_to[*]}") Cc: $(IFS=,; echo "${opt_cc[*]}") + X-Cover-Cc: $(IFS=,; echo "${cover_cc[*]}") Bcc: $(IFS=,; echo "${opt_bcc[*]}") EOF @@ -580,7 +622,7 @@ sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \ -e '/^Subject-Prefix:/d' \ $introduction \ | $QUILT_DIR/scripts/edmail --charset $opt_charset \ - --remove-empty-headers To Cc Bcc \ + --remove-empty-headers To Bcc \ | process_mail if [ -n "$opt_mbox" ] -- 2.26.3 _______________________________________________ Quilt-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/quilt-dev
