Poky Project Discussions
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@linux.intel.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: poky@yoctoproject.org
Subject: Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail
Date: Tue, 21 Dec 2010 16:28:07 -0800	[thread overview]
Message-ID: <4D114617.6060202@linux.intel.com> (raw)
In-Reply-To: <1292924367-19873-1-git-send-email-raj.khem@gmail.com>

On 12/21/2010 01:39 AM, Khem Raj wrote:
> * usually git send-mail is setup by people using git
>    so use git send-mail to post patches for pull requests
>    There is how to setup git send-email
>    see section "Set up git"
>    http://www.openembedded.org/index.php/How_to_submit_a_patch_to_OpenEmbedded

Hi Khem,

I've added an option to use git-send-email in a recent patch sent as a 
pull request (using git-send-email). I had to change it from below in a 
few ways - I'll comment on them here for context:

>
> Signed-off-by: Khem Raj<raj.khem@gmail.com>
> ---
>   scripts/send-pull-request |   19 ++++++++-----------
>   1 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/send-pull-request b/scripts/send-pull-request
> index 0576a5d..2f0b90d 100755
> --- a/scripts/send-pull-request
> +++ b/scripts/send-pull-request
> @@ -12,8 +12,8 @@ Usage: $(basename $0) [-h] [-a] [[-t email]...] -p pull-dir
>   EOM
>   }
>
> -# Collect To and CC addresses from the patch files if they exist
> -# $1: Which header to add the recipients to, "TO" or "CC"
> +# Collect To, From and CC addresses from the patch files if they exist
> +# $1: Which header to add the recipients to, "TO", "FROM" or "CC"

We really shouldn't have to read FROM here, just use sendemail.from from 
your git config.

>   # $2: The regex to match and strip from the line with email addresses
>   harvest_recipients()
>   {
> @@ -27,6 +27,8 @@ harvest_recipients()
>                   if [ -z "$TO" ]; then TO=$EMAIL; else TO="$TO,$EMAIL"; fi
>               elif [ "$TO_CC" == "CC" ]&&  [ "${CC/$EMAIL/}" == "$CC" ]&&  [ -n "$EMAIL" ]; then
>                   if [ -z "$CC" ]; then CC=$EMAIL; else CC="$CC,$EMAIL"; fi
> +            elif [ "$TO_CC" == "FROM" ]&&  [ "${FROM/$EMAIL/}" == "$FROM" ]&&  [ -n "$EMAIL" ]; then
> +                if [ -z "$FROM" ]; then FROM=$EMAIL; fi
>               fi
>           done
>       done
> @@ -85,6 +87,7 @@ done
>   # etc. (*-by) will be added to CC.
>   if [ $AUTO -eq 1 ]; then
>       harvest_recipients TO "^[Tt][Oo]: *"
> +    harvest_recipients FROM "^[Ff][rR][oO][mM]: *"
>       harvest_recipients CC "^[Cc][Cc]: *"
>       harvest_recipients CC "^.*-[Bb][Yy]: *"
>   fi
> @@ -112,20 +115,14 @@ read cont
>   if [ "$cont" == "y" ] || [ "$cont" == "Y" ]; then
>       ERROR=0
>       for PATCH in $PDIR/*patch; do
> -        # Insert To and CC headers via formail to keep them separate and
> -        # appending them to the sendmail command as -- $TO $CC has proven
> -        # to be an exercise in futility.
> -        #
> -        # Use tail to remove the email envelope from git or formail as
> -        # msmtp (sendmail) would choke on them.
> -        cat $PATCH | formail -I "To: $TO" -I "CC: $CC" | tail -n +2 | sendmail -t
> +        # Insert To and CC headers
> +	git send-email --to="$TO" --cc="$CC" --from="$FROM" --confirm=auto $PATCH

git-send-email doesn't accept a comma separated list of address on the 
--to and --cc lines. This was something I ran into last time I tried to 
use git-send-email and had forgotten about. The problem is separating 
them into individual arguments as something like "$TO_LIST" is 
interpreted as a single argument (even with multiple --to arguments in 
it). Turns out, "eval" allows you to do this. I took that approach in 
the patch I sent.

Using --from in this command through an error for me. I setup my git 
config to have sendemail.from specified, and send-email will just use 
that instead of prompting every time.

Please have a look at the patch in the new pull request and let us know 
if it meets your needs.

-- 
Darren Hart
Yocto Linux Kernel


      parent reply	other threads:[~2010-12-22  0:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21  9:39 [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail Khem Raj
2010-12-21 21:19 ` Darren Hart
2010-12-21 21:32   ` Khem Raj
2010-12-21 21:37     ` Bruce Ashfield
2010-12-21 22:22       ` Khem Raj
2010-12-21 22:23         ` Darren Hart
2010-12-21 22:16     ` Darren Hart
2010-12-22  0:28 ` Darren Hart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D114617.6060202@linux.intel.com \
    --to=dvhart@linux.intel.com \
    --cc=poky@yoctoproject.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox