All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kevin P. Fleming" <kpfleming@digium.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] post-receive-email: ensure sent messages are not empty
Date: Mon, 02 Aug 2010 17:17:21 -0500	[thread overview]
Message-ID: <4C5743F1.5020806@digium.com> (raw)
In-Reply-To: <7vk4o8k73w.fsf@alter.siamese.dyndns.org>

On 08/02/2010 05:00 PM, Junio C Hamano wrote:
> "Kevin P. Fleming" <kpfleming@digium.com> writes:
> 
>> @@ -687,10 +699,12 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
>>  	# Output to the terminal in command line mode - if someone wanted to
>>  	# resend an email; they could redirect the output to sendmail
>>  	# themselves
>> -	PAGER= generate_email $2 $3 $1
>> +	prep_for_email $2 $3 $1
>> +	PAGER= generate_email
>>  else
>>  	while read oldrev newrev refname
>>  	do
>> -		generate_email $oldrev $newrev $refname | send_mail
>> +		prep_for_email $oldrev $newrev $refname
>> +		generate_email | send_mail
>>  	done
> 
> As "prep" exits, when this is run as a hook to read many updated refs, any
> inappropriate update to one ref will cause messages for later refs from
> getting sent out.  Earlier such an update may have sent an empty message
> but at least didn't break messages for other refs, if I am reading the
> code correctly.  Is that what you really want?
> 
> Perhaps you would want to do something like this instead, after adjusting
> the exit code from the new "prep" shell function?
> 
> 	while ...
>         do
>         	prep_for_email || continue
>                 generate_email | send_mail
> 	done
> 

You are right; instead of prep_for_email using 'exit 0' to stop the
process as was done before, it should just return an exit code to skip
the current ref being processed. This was also a bug previously, since
generate_email used 'exit 0' to stop the processing of a particular ref,
which would actually stop processing of any further refs as well.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming@digium.com
Check us out at www.digium.com & www.asterisk.org

  reply	other threads:[~2010-08-02 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 20:28 [PATCH] post-receive-email: ensure sent messages are not empty Kevin P. Fleming
2010-08-02 22:00 ` Junio C Hamano
2010-08-02 22:17   ` Kevin P. Fleming [this message]
     [not found] <1283886126-4005-1-git-send-email-kpfleming@digium.com>
2010-09-07 19:04 ` Kevin P. Fleming
  -- strict thread matches above, loose matches on Subject: below --
2010-09-10 16:09 Kevin P. Fleming

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=4C5743F1.5020806@digium.com \
    --to=kpfleming@digium.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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.