summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2011-05-16 20:34:28 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-19 22:40:40 (GMT)
commit943951bb4d0f5ec0a74a3f015623f1c4752f40b9 (patch)
treedf885229b9443e3a6d0a7d991d47acef6cc603bc
parent8402e2281d20ae8d2aa2c60ee9f87a4b481426a1 (diff)
downloadpoky-943951bb4d0f5ec0a74a3f015623f1c4752f40b9.tar.gz
send-pull-request: streamline git-send-email usage
The script was sending one patch at a time, which defeats the internal confirmation mechanism of git-send-email (which would otherwise allow the user to send all patches or abort immediately). Rework the sending logic to use no more than two commands. Use two commands when the cover letter is to be sent to all recipients with the -a argument. Otherwise, send all patches via the same command. The script duplicates git's send confirmation, eliminate that. Reported-by: Khem Raj <raj.khem@gmail.com> (From OE-Core rev: 71286b32b58d4d1318b0a0a4b09ea65604d0e6fc) Signed-off-by: Darren Hart <dvhart@linux.intel.com> Acked-by: Joshua Lock <josh@linux.intel.com> Acked-by: Otavio Salvador <otavio@ossystems.com.br> Cc: Khem Raj <raj.khem@gmail.com> Cc: Joshua Lock <josh@linux.intel.com> Cc: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/send-pull-request68
1 files changed, 26 insertions, 42 deletions
diff --git a/scripts/send-pull-request b/scripts/send-pull-request
index 21eb302..8d0bd34 100755
--- a/scripts/send-pull-request
+++ b/scripts/send-pull-request
@@ -1,6 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2AUTO=0 2AUTO=0
3AUTO_CL=0 3AUTO_CL=0
4GITSOBCC=""
4 5
5# Prevent environment leakage to these vars. 6# Prevent environment leakage to these vars.
6unset TO 7unset TO
@@ -59,10 +60,11 @@ while getopts "achp:t:" OPT; do
59 case $OPT in 60 case $OPT in
60 a) 61 a)
61 AUTO_CL=1 62 AUTO_CL=1
62 AUTO=1 63 # Fall through to include -c
63 ;; 64 ;&
64 c) 65 c)
65 AUTO=1 66 AUTO=1
67 GITSOBCC="--signed-off-by-cc"
66 ;; 68 ;;
67 h) 69 h)
68 usage 70 usage
@@ -130,48 +132,30 @@ if [ -z "$TO" ] && [ -z "$AUTO_CC" ]; then
130fi 132fi
131 133
132 134
133# Generate report for the user and require confirmation before sending 135# Convert the collected addresses into git-send-email argument strings
134cat <<EOM 136export IFS=$','
135The following patches: 137GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
136$(for PATCH in $PDIR/*.patch; do echo " $PATCH"; done) 138GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done)
139unset IFS
137 140
138will now be sent via the git send-email command. Git will prompt you before
139sending any email.
140 141
141EOM 142# Handoff to git-send-email. It will perform the send confirmation.
142echo "Continue? [y/N] " 143PATCHES=$(echo $PDIR/*.patch)
143read cont 144if [ $AUTO_CL -eq 1 ]; then
144 145 # Send the cover letter to every recipient, both specified as well as
145if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then 146 # harvested. Then remove it from the patches list.
146 ERROR=0 147 eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $CL"
147 export IFS=$',' 148 if [ $? -eq 1 ]; then
148 GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done) 149 echo "ERROR: failed to send cover-letter with automatic recipients."
149 GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done) 150 exit 1
150 unset IFS
151 for PATCH in $PDIR/*patch; do
152 if [ $AUTO -eq 1 ]; then
153 if [ $PATCH == "$CL" ] && [ $AUTO_CL -eq 1 ]; then
154 # Send the cover letter to every recipient, both
155 # specified as well as harvested.
156 eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
157 else
158 # Send the patch to the specified recipients and
159 # those git finds in this specific patch.
160 eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --signed-off-by-cc $PATCH"
161 fi
162 else
163 # Only send to the explicitly specified recipients
164 eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
165 fi
166 if [ $? -eq 1 ]; then
167 ERROR=1
168 fi
169 done
170
171 if [ $ERROR -eq 1 ]; then
172 echo "ERROR: Failed to send one or more messages."
173 fi 151 fi
174else 152 PATCHES=${PATCHES/"$CL"/}
175 echo "Send aborted."
176fi 153fi
177 154
155# Send the patch to the specified recipients and, if -c was specified, those git
156# finds in this specific patch.
157eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to $GITSOBCC $PATCHES"
158if [ $? -eq 1 ]; then
159 echo "ERROR: failed to send patches."
160 exit 1
161fi