diff options
Diffstat (limited to 'scripts/send-pull-request')
| -rwxr-xr-x | scripts/send-pull-request | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/scripts/send-pull-request b/scripts/send-pull-request index 5dfc246c34..883deacb07 100755 --- a/scripts/send-pull-request +++ b/scripts/send-pull-request @@ -26,12 +26,13 @@ AUTO=0 AUTO_CL=0 -GITSOBCC="" +GITSOBCC="--suppress-cc=all" # Prevent environment leakage to these vars. unset TO unset CC unset AUTO_CC +unset EXTRA_CC usage() { @@ -42,6 +43,7 @@ Usage: $(basename $0) [-h] [-a] [-c] [[-t email]...] -p pull-dir This option implies -c. -c Expand the Cc list for the individual patches using the Cc and Signed-off-by lines from the same patch. + -C Add extra CC to each email sent. -p pull-dir Directory containing summary and patch files -t email Explicitly add email to the recipients EOM @@ -68,16 +70,20 @@ harvest_recipients() } # Parse and verify arguments -while getopts "achp:t:" OPT; do +while getopts "acC:hp:t:" OPT; do case $OPT in a) + AUTO=1 + GITSOBCC="--signed-off-by-cc" AUTO_CL=1 - # Fall through to include -c - ;& + ;; c) AUTO=1 GITSOBCC="--signed-off-by-cc" ;; + C) + EXTRA_CC="$OPTARG" + ;; h) usage exit 0 @@ -108,15 +114,18 @@ fi # Verify the cover letter is complete and free of tokens -CL="$PDIR/0000-cover-letter.patch" -for TOKEN in SUBJECT BLURB; do - grep -q "*** $TOKEN HERE ***" "$CL" - if [ $? -eq 0 ]; then - echo "ERROR: Please edit $CL and try again (Look for '*** $TOKEN HERE ***')." - exit 1 - fi -done - +if [ -e $PDIR/0000-cover-letter.patch ]; then + CL="$PDIR/0000-cover-letter.patch" + for TOKEN in SUBJECT BLURB; do + grep -q "*** $TOKEN HERE ***" "$CL" + if [ $? -eq 0 ]; then + echo "ERROR: Please edit $CL and try again (Look for '*** $TOKEN HERE ***')." + exit 1 + fi + done +else + echo "WARNING: No cover letter will be sent." +fi # Harvest emails from the generated patches and populate AUTO_CC. if [ $AUTO_CL -eq 1 ]; then @@ -145,15 +154,20 @@ fi 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) +GIT_EXTRA_CC=$(for R in $EXTRA_CC; do echo -n "--cc='$R' "; done) unset IFS - # Handoff to git-send-email. It will perform the send confirmation. +# Mail threading was already handled by git-format-patch in +# create-pull-request, so we must not allow git-send-email to +# add In-Reply-To and References headers again. 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" + # --no-thread is redundant here (only sending a single message) and + # merely added for the sake of consistency. + eval "git send-email $GIT_TO $GIT_CC $GIT_EXTRA_CC --confirm=always --no-thread --suppress-cc=all $CL" if [ $? -eq 1 ]; then echo "ERROR: failed to send cover-letter with automatic recipients." exit 1 @@ -163,7 +177,7 @@ 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" +eval "git send-email $GIT_TO $GIT_EXTRA_CC --confirm=always --no-thread $GITSOBCC $PATCHES" if [ $? -eq 1 ]; then echo "ERROR: failed to send patches." exit 1 |
