X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tg-mail.sh;h=4a684644a3977d0c2174e7aa7a8f7f5eeed97031;hb=a20892979b7eebb2218a2744747d68964e1cd48f;hp=dd50004a96127f9b6a26a93d1c47503c8aa1882d;hpb=fde494fdb3a1606f68a410e789e4f930a68b5df0;p=topgit.git diff --git a/tg-mail.sh b/tg-mail.sh index dd50004..4a68464 100644 --- a/tg-mail.sh +++ b/tg-mail.sh @@ -29,6 +29,10 @@ done base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" || die "not a TopGit-controlled branch" +if ! git send-email --help >/dev/null 2>&1; then + die "git send-email command not available" +fi + if [ -n "$in_reply_to" ]; then send_email_args="$send_email_args --in-reply-to=$in_reply_to" fi @@ -46,14 +50,14 @@ from="$(echo "$header" | grep '^From:' | sed 's/From:\s*//')" to="$(echo "$header" | grep '^To:' | sed 's/To:\s*//')" -# XXX: I can't get quoting right without arrays -people=() -[ -n "$from" ] && people=("${people[@]}" --from "$from") +people= +[ -n "$from" ] && people="$people --from '$from'" # FIXME: there could be multimple To -[ -n "$to" ] && people=("${people[@]}" --to "$to") - +[ -n "$to" ] && people="$people --to '$to'" # NOTE: git-send-email handles cc itself -git send-email $send_email_args "${people[@]}" "$patchfile" +eval git send-email $send_email_args "$people" "$patchfile" rm "$patchfile" + +# vim:noet