From c86f9a3696d40e5f8c9aba4e67b0099b408d7399 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 19 Nov 2018 02:58:27 +1100 Subject: [PATCH 1/1] introduce get_contacts function and use it --- common.sh | 6 ++++++ get_contacts | 14 ++++++++++++++ message_helper | 4 +--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 get_contacts diff --git a/common.sh b/common.sh index 827015a..5e27d5f 100644 --- a/common.sh +++ b/common.sh @@ -47,4 +47,10 @@ export NEXT_GCC_PPC_VERSION="$gcc_ppc_version" export NEXT_GCC_PPCLE_VERSION="$gcc_ppcle_version" export NEXT_J_FACTOR="$j_factor" +# Support functions +get_contacts() +{ + awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $1; }' $CTRL_FILE +} + true diff --git a/get_contacts b/get_contacts new file mode 100755 index 0000000..7e3092d --- /dev/null +++ b/get_contacts @@ -0,0 +1,14 @@ +#!/bin/bash + +tree= +if [ "$1" ]; then + tree=$1 + shift +fi + +tools_dir=$(dirname "$0") +. "$tools_dir/common.sh" + +get_contacts "$tree" + +exit 0 diff --git a/message_helper b/message_helper index bd7c110..3a1963c 100755 --- a/message_helper +++ b/message_helper @@ -4,8 +4,6 @@ log=$LOG_FILE [ -f merge.log ] && log=merge.log -control=$CTRL_FILE -[ -f control ] && control=control branch="" [ "$1" = "-t" ] && { @@ -26,7 +24,7 @@ cc="Linux-Next Mailing List , Linux Kernel Mailing L branch=${branch%%/*} } -contact=$(awk -F ' ' '$3=="'"$branch"'" { print $1; }' $control) +contact=$(get_contacts "$branch") greeting=${contact%% *} greeting=${greeting#\"} [ "${contact%,*}" = "${contact}" ] || greeting="all" -- 2.39.2