control=../real_control
[ -f real_control ] && control=real_control
-branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //')
-branch=${branch#quilt/}
-branch=${branch%%/*}
+branch=""
+[ "$1" = "-t" ] && {
+ branch=$2
+ shift 2
+}
-contact=$(sed -n "/ $branch /s/ .*$//p" $control)
+[ "$branch" ] || {
+ branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
+ branch=${branch%%/*}
+}
-sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: $branch tree build failure&Body=Hi ,%0A\
+contact=$(awk -F ' ' '$3=="'"$branch"'" { print $1; }' $control)
+greeting=${contact%% *}
+greeting=${greeting#\"}
+[ "${contact%,*}" = "${contact}" ] || greeting="all"
+
+sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: build failure after merge of the $branch tree&Body=Hi $greeting,%0A\
%0A\
-Today's linux-next build () failed like this:"
+After merging the $branch tree, today's linux-next build ()%0A\
+failed like this:"