2 # TopGit - A different patch queue manager
17 [ -z "$head_from" ] || die
"-i and -w are mutually exclusive"
20 send_email_args
="$1"; shift;;
22 in_reply_to
="$1"; shift;;
24 echo "Usage: ${tgname:-tg} [...] mail [-s <send-email-args>] [-r <reference-msgid>] [-i | -w] [<name>]" >&2
27 [ -z "$name" ] || die
"name already specified ($name)"
32 name
="$(verify_topgit_branch "${name:-HEAD}")"
33 base_rev
="$(git rev-parse --short --verify "refs
/top-bases
/$name" 2>/dev/null)" ||
34 die
"not a TopGit-controlled branch"
36 if [ -n "$in_reply_to" ]; then
37 send_email_args
="$send_email_args --in-reply-to='$in_reply_to'"
41 patchfile
="$(get_temp tg-mail)"
43 # let tg patch sort out whether $head_from makes sense for $name
44 $tg patch "$name" $head_from >"$patchfile"
46 header
="$(sed -e '/^$/,$d' -e "s
,','\\\\'',g
" "$patchfile")"
50 from
="$(echo "$header" | grep '^From:' | sed 's/From:\s*//')"
51 to
="$(echo "$header" | grep '^To:' | sed 's/To:\s*//')"
55 [ -n "$from" ] && people
="$people --from '$from'"
56 # FIXME: there could be multiple To
57 [ -n "$to" ] && people
="$people --to '$to'"
59 # NOTE: git-send-email handles cc itself
60 eval git send-email
$send_email_args "$people" "$patchfile"