Skip to contentSkip to conversation

Grok git config sendmail.to if available

PATCH Superseded Khem Raj 2 participants 3 messages Mar 12, 2011 – Mar 14, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Grok git config sendmail.to if available

Pull URL: git://git.openembedded.org/openembedded-core-contrib.git
Branch: kraj/scripts
Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/scripts

Thanks,
Khem Raj <[email protected]>
---

Khem Raj (1):
send-pull-request: Fetch TO email address from git config if
specified

 scripts/send-pull-request |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 1/1 send-pull-request: Fetch TO email address from git config if specified

Usually people using git send-email has git config sendmail.to configured to the usual mailing list or person so we harness that here.

---
 scripts/send-pull-request |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
scripts/send-pull-request +15 -6
index 7f51a1b..c5dc9a9 100755
@@ -109,15 +109,17 @@ if [ $AUTO -eq 1 ]; then
     harvest_recipients CC "^.*-[Bb][Yy]: *"
 fi
 
-if [ -z "$TO" ] && [ -z "$CC" ]; then
-    echo "ERROR: you have not specified any recipients."
-    usage
-    exit 1
-fi
-
 case "$PULL_MTA" in
     git)
         FROM="$(git config sendemail.from)"
+	AUTO_TO="$(git config sendemail.to)"
+	if [ ! -e "$AUTO_TO" ]; then
+	    if [ ! -e $TO ]; then
+		TO="$TO,$AUTO_TO"
+	    else
+		TO="$AUTO_TO"
+	    fi
+	fi
         ;;
     sendmail)
         if [ -z "$FROM" ]; then
@@ -131,6 +133,13 @@ case "$PULL_MTA" in
         ;;
 esac
 
+if [ -z "$TO" ] && [ -z "$CC" ]; then
+    echo "ERROR: you have not specified any recipients."
+    usage
+    exit 1
+fi
+
+
 # Generate report for the user and require confirmation before sending
 cat <<EOM
 The following patches:
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/1] send-pull-request: Fetch TO email address from git config if specified

Hi Khem,

Quoted 3 lines · Khem Raj

Usually people using git send-email has git config sendmail.to configured to the usual mailing list or person so we harness that here.

OK, good idea, couple concerns below.

Quoted 15 lines
---
  scripts/send-pull-request |   21 +++++++++++++++------
  1 files changed, 15 insertions(+), 6 deletions(-)
scripts/send-pull-request +0 -1
index 7f51a1b..c5dc9a9 100755
@@ -109,15 +109,17 @@ if [ $AUTO -eq 1 ]; then
      harvest_recipients CC "^.*-[Bb][Yy]: *"
  fi
 
-if [ -z "$TO" ]&&  [ -z "$CC" ]; then

scripts/send-pull-request if [ $AUTO -eq 1 ]; then · line 116

Quoted 10 lines
scripts/send-pull-request +2 -5
-    echo "ERROR: you have not specified any recipients."
-    usage
-    exit 1
-fi
-
  case "$PULL_MTA" in
      git)
          FROM="$(git config sendemail.from)"
+	AUTO_TO="$(git config sendemail.to)"
+	if [ ! -e "$AUTO_TO" ]; then

-e tests for file existence...

scripts/send-pull-request if [ $AUTO -eq 1 ]; then · line 117

Quoted 1 line
scripts/send-pull-request +1 -0
+	    if [ ! -e $TO ]; then

Here too, and please quote all shell variables.

I think you want -n:

if [ -n "$AUTO_TO" ]; then

	if [ -n "$TO" ]; then

Thanks,

Darren

Quoted 22 lines
scripts/send-pull-request +12 -0
+		TO="$TO,$AUTO_TO"
+	    else
+		TO="$AUTO_TO"
+	    fi
+	fi
          ;;
      sendmail)
          if [ -z "$FROM" ]; then
@@ -131,6 +133,13 @@ case "$PULL_MTA" in
          ;;
  esac
 
+if [ -z "$TO" ]&&  [ -z "$CC" ]; then
+    echo "ERROR: you have not specified any recipients."
+    usage
+    exit 1
+fi
+
+
  # Generate report for the user and require confirmation before sending
  cat<<EOM
  The following patches:
Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel