]> code.ossystems Code Review - openembedded-core.git/commitdiff
send-pull-request: verify git sendemail config
authorDarren Hart <dvhart@linux.intel.com>
Fri, 13 May 2011 22:42:37 +0000 (15:42 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 May 2011 22:37:53 +0000 (23:37 +0100)
Perform a quick sanity check to be able to direct users to configure
git.sendemail if they haven't yet.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Otavio Salvador <otavio@ossystems.com.br>
scripts/send-pull-request

index 5a11d1f1e61f087d80cf7dd0c0f74542cffd6758..21eb302169c5845800f7941f7870582adf51873c 100755 (executable)
@@ -41,6 +41,18 @@ harvest_recipients()
        unset IFS
 }
 
+check_git_sendemail_config()
+{
+       GIT_SMTP=$(git config sendemail.smtpserver)
+       GIT_FROM=$(git config sendemail.from)
+       if [ -z "$GIT_SMTP" ] || [ -z "$GIT_FROM" ]; then
+               echo "ERROR: git sendemail is not configured."
+               echo "Please read GIT-SEND-EMAIL(1) and configure:"
+               echo "  sendemail.smtpserver"
+               echo "  sendemail.from"
+               exit 1
+       fi
+}
 
 # Parse and verify arguments
 while getopts "achp:t:" OPT; do
@@ -74,6 +86,9 @@ while getopts "achp:t:" OPT; do
        esac
 done
 
+# Abort early if git-send-email is not properly configured
+check_git_sendemail_config
+
 if [ -z "$PDIR" ]; then
        echo "ERROR: you must specify a pull-dir."
        usage