summaryrefslogtreecommitdiffstats
path: root/scripts/send-pull-request
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2011-05-16 13:34:28 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-19 23:40:40 +0100
commit943951bb4d0f5ec0a74a3f015623f1c4752f40b9 (patch)
treedf885229b9443e3a6d0a7d991d47acef6cc603bc /scripts/send-pull-request
parent8402e2281d20ae8d2aa2c60ee9f87a4b481426a1 (diff)
downloadast2050-yocto-poky-943951bb4d0f5ec0a74a3f015623f1c4752f40b9.zip
ast2050-yocto-poky-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>
Diffstat (limited to 'scripts/send-pull-request')
-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 @@
#!/bin/bash
AUTO=0
AUTO_CL=0
+GITSOBCC=""
# Prevent environment leakage to these vars.
unset TO
@@ -59,10 +60,11 @@ while getopts "achp:t:" OPT; do
case $OPT in
a)
AUTO_CL=1
- AUTO=1
- ;;
+ # Fall through to include -c
+ ;&
c)
AUTO=1
+ GITSOBCC="--signed-off-by-cc"
;;
h)
usage
@@ -130,48 +132,30 @@ if [ -z "$TO" ] && [ -z "$AUTO_CC" ]; then
fi
-# Generate report for the user and require confirmation before sending
-cat <<EOM
-The following patches:
-$(for PATCH in $PDIR/*.patch; do echo " $PATCH"; done)
+# Convert the collected addresses into git-send-email argument strings
+export IFS=$','
+GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
+GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done)
+unset IFS
-will now be sent via the git send-email command. Git will prompt you before
-sending any email.
-EOM
-echo "Continue? [y/N] "
-read cont
-
-if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
- ERROR=0
- export IFS=$','
- GIT_TO=$(for R in $TO; do echo -n "--to='$R' "; done)
- GIT_CC=$(for R in $AUTO_CC; do echo -n "--cc='$R' "; done)
- unset IFS
- for PATCH in $PDIR/*patch; do
- if [ $AUTO -eq 1 ]; then
- if [ $PATCH == "$CL" ] && [ $AUTO_CL -eq 1 ]; then
- # Send the cover letter to every recipient, both
- # specified as well as harvested.
- eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
- else
- # Send the patch to the specified recipients and
- # those git finds in this specific patch.
- eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --signed-off-by-cc $PATCH"
- fi
- else
- # Only send to the explicitly specified recipients
- eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to --suppress-cc=all $PATCH"
- fi
- if [ $? -eq 1 ]; then
- ERROR=1
- fi
- done
-
- if [ $ERROR -eq 1 ]; then
- echo "ERROR: Failed to send one or more messages."
+# Handoff to git-send-email. It will perform the send confirmation.
+PATCHES=$(echo $PDIR/*.patch)
+if [ $AUTO_CL -eq 1 ]; then
+ # Send the cover letter to every recipient, both specified as well as
+ # harvested. Then remove it from the patches list.
+ eval "git send-email $GIT_TO $GIT_CC --confirm=always --no-chain-reply-to --suppress-cc=all $CL"
+ if [ $? -eq 1 ]; then
+ echo "ERROR: failed to send cover-letter with automatic recipients."
+ exit 1
fi
-else
- echo "Send aborted."
+ PATCHES=${PATCHES/"$CL"/}
fi
+# Send the patch to the specified recipients and, if -c was specified, those git
+# finds in this specific patch.
+eval "git send-email $GIT_TO --confirm=always --no-chain-reply-to $GITSOBCC $PATCHES"
+if [ $? -eq 1 ]; then
+ echo "ERROR: failed to send patches."
+ exit 1
+fi
OpenPOWER on IntegriCloud