exit ${1:-0}
}
+auto=false
while [[ -n $1 ]] ; do
case $1 in
-h|--help) usage;;
+ -e) auto=true;;
--) shift; break;;
-*) usage 1;;
*) break;
name=$(git config --get user.name)
email=$(git config --get user.email)
-cat << EOF
+tmp=$(mktemp)
+cat << EOF > ${tmp}
From: ${name} <${email}>
Date: $(date -R)
Subject: Pull request ${url##*/}
$(git request-pull ${commit} ${url} ${branch})
EOF
+cat ${tmp}
-echo git send-email \
- --to \"$(git config --get sendemail.pullrequest)\" \
- --cc \"$(git config --get sendemail.to)\" ... 1>&2
+to=$(git config --get sendemail.pullrequest)
+cc=$(git config --get sendemail.to)
+if ${auto} ; then
+ git send-email --to "${to}" --cc "${cc}" ${tmp}
+else
+ echo git send-email --to \"${to}\" --cc \"${cc}\" ... 1>&2
+fi
+rm -f ${tmp}