X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=message_helper;h=d13360a7a22f02e818af672d9779e1f7923228ac;hb=HEAD;hp=3a1963c543d2d672aee6de9abb37067ab403e423;hpb=c86f9a3696d40e5f8c9aba4e67b0099b408d7399;p=next-scripts diff --git a/message_helper b/message_helper index 3a1963c..d13360a 100755 --- a/message_helper +++ b/message_helper @@ -1,44 +1,47 @@ #!/bin/bash -. "$(dirname $0)/common.sh" "" +# shellcheck source=./common.sh +. "$(dirname "$0")/common.sh" '' -log=$LOG_FILE -[ -f merge.log ] && log=merge.log +log="$LOG_FILE" +if [ -f merge.log ]; then + log='merge.log' +fi -branch="" -[ "$1" = "-t" ] && { - branch=$2 +branch= +if [ "$1" = '-b' ]; then + branch="$2" shift 2 -} +fi -kconfig="" -[ "$1" = "-c" ] && { - kconfig=$2 +kconfig= +if [ "$1" = '-c' ]; then + kconfig="$2" shift 2 -} +fi -cc="Linux-Next Mailing List , Linux Kernel Mailing List " +subject="$1" +shift -[ "$branch" ] || { - branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//') - branch=${branch%%/*} -} +cc=( 'Linux Next Mailing List ' + 'Linux Kernel Mailing List ' + "$@" ) -contact=$(get_contacts "$branch") -greeting=${contact%% *} -greeting=${greeting#\"} -[ "${contact%,*}" = "${contact}" ] || greeting="all" - -subject="${1//BRANCH/$branch}" -filter="sed -e \"s/BRANCH/$branch/g\"" -[ "$kconfig" ] && - filter="$filter -e \"s/KCONFIG_NAME/$kconfig/g\"" -filter="$filter | fmt -s" +if [ -z "$branch" ]; then + branch=$(grep '^Merging ' "$log" | tail -n 1 | + sed 's/^Merging \([^ /]*\).*$/\1/') +fi -$(dirname $0)/send_email "$contact" "$cc" "linux-next: $subject" <