summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 21eb302169..8d0bd343ee 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