]> git.wh0rd.org Git - home.git/commitdiff
add an auto flag to send e-mail for me
authorMike Frysinger <vapier@gentoo.org>
Thu, 21 May 2009 21:29:09 +0000 (17:29 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:07 +0000 (15:36 -0400)
.bin/git-format-request-pull

index 7c4f3a6909a1d1cb37397c1484ace8dc435cde85..9845b00789e81593273a284ffe55f5978da576eb 100755 (executable)
@@ -5,9 +5,11 @@ usage() {
        exit ${1:-0}
 }
 
+auto=false
 while [[ -n $1 ]] ; do
        case $1 in
                -h|--help) usage;;
+               -e) auto=true;;
                --) shift; break;;
                -*) usage 1;;
                *)  break;
@@ -25,14 +27,21 @@ fi
 
 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}