* [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail @ 2010-12-21 9:39 Khem Raj 2010-12-21 21:19 ` Darren Hart 2010-12-22 0:28 ` Darren Hart 0 siblings, 2 replies; 8+ messages in thread From: Khem Raj @ 2010-12-21 9:39 UTC (permalink / raw) To: poky * 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 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" # $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 if [ $? -eq 1 ]; then ERROR=1 fi done if [ $ERROR -eq 1 ]; then - echo "ERROR: sendmail failed to send one or more messages. Check your" - echo " sendmail log for details." + echo "ERROR: git send-mail failed to send one or more messages." fi else echo "Send aborted." -- 1.7.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 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-22 0:28 ` Darren Hart 1 sibling, 1 reply; 8+ messages in thread From: Darren Hart @ 2010-12-21 21:19 UTC (permalink / raw) To: Khem Raj; +Cc: poky 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 I didn't use git-send-email for this script because of a few complications with it. First, when using the --compose option, there is no way to pass it a file for the cover-letter. Second, it doesn't scan the entire patch series for recipients and will send each mail in the thread to different recipients - including the cover letter, which I find simply obnoxious. These prevent it from being used as a single command with a refspec for the range of patches. If you aren't going to do this, then using it in a loop is effectively the same as using sendmail. If you're using git-send-email, then you already have local sendmail setup. Other than using your local git mail aliases, I don't see any advantage to using git-send-email. If you're using the auto-harvest feature, you had to dig up the proper email addresses anyway. It does however add a second configuration step - the [sendemail] section. I do have this setup myself, but enough people trip over just getting a local sendmail configuration working that adding git sendemail to that just doesn't seem worth it to me. Is there an advantage to git sendemail that I am overlooking? Thanks, Darren Hart > > 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" > # $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 > if [ $? -eq 1 ]; then > ERROR=1 > fi > done > if [ $ERROR -eq 1 ]; then > - echo "ERROR: sendmail failed to send one or more messages. Check your" > - echo " sendmail log for details." > + echo "ERROR: git send-mail failed to send one or more messages." > fi > else > echo "Send aborted." -- Darren Hart Yocto Linux Kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 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:16 ` Darren Hart 0 siblings, 2 replies; 8+ messages in thread From: Khem Raj @ 2010-12-21 21:32 UTC (permalink / raw) To: Darren Hart; +Cc: poky On Tue, Dec 21, 2010 at 1:19 PM, Darren Hart <dvhart@linux.intel.com> wrote: > 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 > > I didn't use git-send-email for this script because of a few complications > with it. First, when using the --compose option, there is no way to pass it > a file for the cover-letter. Second, it doesn't scan the entire patch series > for recipients and will send each mail in the thread to different recipients > - including the cover letter, which I find simply obnoxious. These prevent > it from being used as a single command with a refspec for the range of > patches. If you aren't going to do this, then using it in a loop is > effectively the same as using sendmail. If you're using git-send-email, then > you already have local sendmail setup. No I dont. I use smtpserver with git send-email > > Other than using your local git mail aliases, I don't see any advantage to > using git-send-email. if using git then its easier for people to use git commands and I think git email setup is easier than setting up sendmail. If you're using the auto-harvest feature, you had to > dig up the proper email addresses anyway. It does however add a second > configuration step - the [sendemail] section. I do have this setup myself, > but enough people trip over just getting a local sendmail configuration > working that adding git sendemail to that just doesn't seem worth it to me. > > Is there an advantage to git sendemail that I am overlooking? I think git send-email sends the patches the expected way and one does not have to worry about chopping etc. that the script currently does. > > Thanks, > > Darren Hart > >> >> 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" >> # $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 >> if [ $? -eq 1 ]; then >> ERROR=1 >> fi >> done >> if [ $ERROR -eq 1 ]; then >> - echo "ERROR: sendmail failed to send one or more messages. Check >> your" >> - echo " sendmail log for details." >> + echo "ERROR: git send-mail failed to send one or more messages." >> fi >> else >> echo "Send aborted." > > > -- > Darren Hart > Yocto Linux Kernel > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 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:16 ` Darren Hart 1 sibling, 1 reply; 8+ messages in thread From: Bruce Ashfield @ 2010-12-21 21:37 UTC (permalink / raw) To: Khem Raj; +Cc: poky On Tue, Dec 21, 2010 at 4:32 PM, Khem Raj <raj.khem@gmail.com> wrote: > On Tue, Dec 21, 2010 at 1:19 PM, Darren Hart <dvhart@linux.intel.com> wrote: >> 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 >> >> I didn't use git-send-email for this script because of a few complications >> with it. First, when using the --compose option, there is no way to pass it >> a file for the cover-letter. Second, it doesn't scan the entire patch series >> for recipients and will send each mail in the thread to different recipients >> - including the cover letter, which I find simply obnoxious. These prevent >> it from being used as a single command with a refspec for the range of >> patches. If you aren't going to do this, then using it in a loop is >> effectively the same as using sendmail. If you're using git-send-email, then >> you already have local sendmail setup. > > No I dont. I use smtpserver with git send-email > >> >> Other than using your local git mail aliases, I don't see any advantage to >> using git-send-email. > > if using git then its easier for people to use git commands and I > think git email setup > is easier than setting up sendmail. > > If you're using the auto-harvest feature, you had to >> dig up the proper email addresses anyway. It does however add a second >> configuration step - the [sendemail] section. I do have this setup myself, >> but enough people trip over just getting a local sendmail configuration >> working that adding git sendemail to that just doesn't seem worth it to me. >> >> Is there an advantage to git sendemail that I am overlooking? > > I think git send-email sends the patches the expected way and one does not > have to worry about chopping etc. that the script currently does. I don't see this as a one vs the other sort of thing. I've been sending patches to the lists using Darren's front end, but then using git send-email to actually transmit the patches (since I don't have sendmail on all my boxes). So I'd suggest simply making the sending configurable, since clobbering one with the other doesn't meet everyone's needs. Cheers, Bruce > >> >> Thanks, >> >> Darren Hart >> >>> >>> 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" >>> # $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 >>> if [ $? -eq 1 ]; then >>> ERROR=1 >>> fi >>> done >>> if [ $ERROR -eq 1 ]; then >>> - echo "ERROR: sendmail failed to send one or more messages. Check >>> your" >>> - echo " sendmail log for details." >>> + echo "ERROR: git send-mail failed to send one or more messages." >>> fi >>> else >>> echo "Send aborted." >> >> >> -- >> Darren Hart >> Yocto Linux Kernel >> > _______________________________________________ > poky mailing list > poky@yoctoproject.org > https://lists.yoctoproject.org/listinfo/poky > -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end" ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 2010-12-21 21:37 ` Bruce Ashfield @ 2010-12-21 22:22 ` Khem Raj 2010-12-21 22:23 ` Darren Hart 0 siblings, 1 reply; 8+ messages in thread From: Khem Raj @ 2010-12-21 22:22 UTC (permalink / raw) To: Bruce Ashfield; +Cc: poky > I don't see this as a one vs the other sort of thing. I've been sending > patches to the lists using Darren's front end, but then using git send-email > to actually transmit the patches (since I don't have sendmail on all > my boxes). > > So I'd suggest simply making the sending configurable, since clobbering > one with the other doesn't meet everyone's needs. yes that would be preferable. -Khem ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 2010-12-21 22:22 ` Khem Raj @ 2010-12-21 22:23 ` Darren Hart 0 siblings, 0 replies; 8+ messages in thread From: Darren Hart @ 2010-12-21 22:23 UTC (permalink / raw) To: Khem Raj; +Cc: poky On 12/21/2010 02:22 PM, Khem Raj wrote: >> I don't see this as a one vs the other sort of thing. I've been sending >> patches to the lists using Darren's front end, but then using git send-email >> to actually transmit the patches (since I don't have sendmail on all >> my boxes). >> >> So I'd suggest simply making the sending configurable, since clobbering >> one with the other doesn't meet everyone's needs. > > yes that would be preferable. Have a patch en-route.... some testing first... be a moment. > > -Khem -- Darren Hart Yocto Linux Kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 2010-12-21 21:32 ` Khem Raj 2010-12-21 21:37 ` Bruce Ashfield @ 2010-12-21 22:16 ` Darren Hart 1 sibling, 0 replies; 8+ messages in thread From: Darren Hart @ 2010-12-21 22:16 UTC (permalink / raw) To: Khem Raj; +Cc: poky On 12/21/2010 01:32 PM, Khem Raj wrote: > On Tue, Dec 21, 2010 at 1:19 PM, Darren Hart<dvhart@linux.intel.com> wrote: >> 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 >> >> I didn't use git-send-email for this script because of a few complications >> with it. First, when using the --compose option, there is no way to pass it >> a file for the cover-letter. Second, it doesn't scan the entire patch series >> for recipients and will send each mail in the thread to different recipients >> - including the cover letter, which I find simply obnoxious. These prevent >> it from being used as a single command with a refspec for the range of >> patches. If you aren't going to do this, then using it in a loop is >> effectively the same as using sendmail. If you're using git-send-email, then >> you already have local sendmail setup. > > No I dont. I use smtpserver with git send-email OK, I meant a local MTA. I use msmtp-mta so as to avoid the complexity of postfix/exim. It talks directly to an external smtp server, but provides a sendmail mode with a sendmail symlink to msmtp. I believe ssmtp does something similar. This effectively moves the config outside of git into the tools config files, but they are no more complicated than git's smtp-server directives. >> >> Other than using your local git mail aliases, I don't see any advantage to >> using git-send-email. > > if using git then its easier for people to use git commands and I Since the script abstracts all the git commands away for the purpose of sending the pull request, it doesn't seem like it would matter there. If you mean you don't want to have to setup another mail tool, I hear you there and understand. Consider msmtp, it's trivial to setup with an external smtp server. > think git email setup > is easier than setting up sendmail. It's easier than postfix and exim - no argument there. msmtp and ssmtp are very trivial MTA providers that work with git and provide a sendmail compatibile command. > If you're using the auto-harvest feature, you had to >> dig up the proper email addresses anyway. It does however add a second >> configuration step - the [sendemail] section. I do have this setup myself, >> but enough people trip over just getting a local sendmail configuration >> working that adding git sendemail to that just doesn't seem worth it to me. >> >> Is there an advantage to git sendemail that I am overlooking? > > I think git send-email sends the patches the expected way and one does not > have to worry about chopping etc. that the script currently does. If so, that's an advantage. Can you have a look and see if that is indeed the case? As it is, we seem to be talking about making it simpler to configure a local MTA. msmtp and ssmtp provide a very simple way to do that, and is applicable to more than just git. Setting up git isn't difficult either, but doesn't offer any advantage that I can see (with the possible exception of eliminating the pipe hackery in the current script). Unless we can show this more than a bike-shed discussion, I'd just assume leave it alone - or add a -g option that sends mail using git-send-email instead (with an option to set it in an env var maybe). Perhaps that would meet everyone's needs? Thanks, Darren > >> >> Thanks, >> >> Darren Hart >> >>> >>> 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" >>> # $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 >>> if [ $? -eq 1 ]; then >>> ERROR=1 >>> fi >>> done >>> if [ $ERROR -eq 1 ]; then >>> - echo "ERROR: sendmail failed to send one or more messages. Check >>> your" >>> - echo " sendmail log for details." >>> + echo "ERROR: git send-mail failed to send one or more messages." >>> fi >>> else >>> echo "Send aborted." >> >> >> -- >> Darren Hart >> Yocto Linux Kernel >> -- Darren Hart Yocto Linux Kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] scripts/send-pull-request: Use git send-mail instead of sendmail 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-22 0:28 ` Darren Hart 1 sibling, 0 replies; 8+ messages in thread From: Darren Hart @ 2010-12-22 0:28 UTC (permalink / raw) To: Khem Raj; +Cc: poky 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-12-22 0:28 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.