* [PATCH] Corrected return values in post-receive-email.prep_for_email
@ 2010-12-07 16:32 Alan Raison
2010-12-07 16:50 ` Thiago Farina
2010-12-07 19:34 ` Junio C Hamano
0 siblings, 2 replies; 9+ messages in thread
From: Alan Raison @ 2010-12-07 16:32 UTC (permalink / raw
To: git; +Cc: alan
---
contrib/hooks/post-receive-email | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/hooks/post-receive-email
b/contrib/hooks/post-receive-email
index 85724bf..020536d 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -150,7 +150,7 @@ prep_for_email()
# Anything else (is there anything else?)
echo >&2 "*** Unknown type of update to $refname
($rev_type)"
echo >&2 "*** - no email generated"
- return 0
+ return 1
;;
esac
@@ -166,10 +166,10 @@ prep_for_email()
esac
echo >&2 "*** $config_name is not set so no email will be
sent"
echo >&2 "*** for $refname update $oldrev->$newrev"
- return 0
+ return 1
fi
- return 1
+ return 0
}
#
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Corrected return values in post-receive-email.prep_for_email
2010-12-07 16:32 [PATCH] Corrected return values in post-receive-email.prep_for_email Alan Raison
@ 2010-12-07 16:50 ` Thiago Farina
2010-12-07 17:10 ` Alan Raison
2010-12-07 19:34 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Thiago Farina @ 2010-12-07 16:50 UTC (permalink / raw
To: Alan Raison; +Cc: git
Care to explain in the change log message why the return value should
be 1 instead of 0?
On Tue, Dec 7, 2010 at 2:32 PM, Alan Raison <alan@theraisons.me.uk> wrote:
> ---
> contrib/hooks/post-receive-email | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/hooks/post-receive-email
> b/contrib/hooks/post-receive-email
> index 85724bf..020536d 100755
> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -150,7 +150,7 @@ prep_for_email()
> # Anything else (is there anything else?)
> echo >&2 "*** Unknown type of update to $refname
> ($rev_type)"
> echo >&2 "*** - no email generated"
> - return 0
> + return 1
> ;;
> esac
>
> @@ -166,10 +166,10 @@ prep_for_email()
> esac
> echo >&2 "*** $config_name is not set so no email will be
> sent"
> echo >&2 "*** for $refname update $oldrev->$newrev"
> - return 0
> + return 1
> fi
>
> - return 1
> + return 0
> }
>
> #
> --
> 1.7.3.1.msysgit.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] Corrected return values in post-receive-email.prep_for_email
2010-12-07 16:50 ` Thiago Farina
@ 2010-12-07 17:10 ` Alan Raison
0 siblings, 0 replies; 9+ messages in thread
From: Alan Raison @ 2010-12-07 17:10 UTC (permalink / raw
To: 'Thiago Farina'; +Cc: git
In the main loop (lines 734 and 738 in the current master) the && and || operations assume true==0 and false==1; in line with shell defaults.
I tested it on a sourceforge shell (I think using Bash); error conditions reported an error to standard error, then proceeded to generate the email; if prep_for_email succeeded then no mail was sent.
HTH
Alan
-----Original Message-----
From: Thiago Farina [mailto:tfransosi@gmail.com]
Sent: 07 December 2010 16:50
To: Alan Raison
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Corrected return values in post-receive-email.prep_for_email
Care to explain in the change log message why the return value should
be 1 instead of 0?
On Tue, Dec 7, 2010 at 2:32 PM, Alan Raison <alan@theraisons.me.uk> wrote:
> ---
> contrib/hooks/post-receive-email | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/hooks/post-receive-email
> b/contrib/hooks/post-receive-email
> index 85724bf..020536d 100755
> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -150,7 +150,7 @@ prep_for_email()
> # Anything else (is there anything else?)
> echo >&2 "*** Unknown type of update to $refname
> ($rev_type)"
> echo >&2 "*** - no email generated"
> - return 0
> + return 1
> ;;
> esac
>
> @@ -166,10 +166,10 @@ prep_for_email()
> esac
> echo >&2 "*** $config_name is not set so no email will be
> sent"
> echo >&2 "*** for $refname update $oldrev->$newrev"
> - return 0
> + return 1
> fi
>
> - return 1
> + return 0
> }
>
> #
> --
> 1.7.3.1.msysgit.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Corrected return values in post-receive-email.prep_for_email
2010-12-07 16:32 [PATCH] Corrected return values in post-receive-email.prep_for_email Alan Raison
2010-12-07 16:50 ` Thiago Farina
@ 2010-12-07 19:34 ` Junio C Hamano
2010-12-07 19:44 ` Kevin P. Fleming
1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2010-12-07 19:34 UTC (permalink / raw
To: Alan Raison; +Cc: git, Kevin P. Fleming
"Alan Raison" <alan@theraisons.me.uk> writes:
> ---
> contrib/hooks/post-receive-email | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
No sign-off, no description.
This is a regression introduced by 53cad69 (post-receive-email: ensure
sent messages are not empty, 2010-09-10), I think.
> diff --git a/contrib/hooks/post-receive-email
> b/contrib/hooks/post-receive-email
> index 85724bf..020536d 100755
> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -150,7 +150,7 @@ prep_for_email()
> # Anything else (is there anything else?)
> echo >&2 "*** Unknown type of update to $refname
> ($rev_type)"
> echo >&2 "*** - no email generated"
> - return 0
> + return 1
This used to "exit 1" before 53cad69 and I agree with the patch that
signalling error with "return 1" is the right thing to do here.
> ;;
> esac
>
> @@ -166,10 +166,10 @@ prep_for_email()
> esac
> echo >&2 "*** $config_name is not set so no email will be
> sent"
> echo >&2 "*** for $refname update $oldrev->$newrev"
> - return 0
> + return 1
This used to "exit 0" before 53cad69 to cause the program stop before
sending mails. Again, I agree with the patch that signalling error is the
right thing to do here.
> fi
>
> - return 1
> + return 0
And this obviously is correct.
Kevin, care to review and Ack? Alan, care to add a few lines of patch
description and sign-off?
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Corrected return values in post-receive-email.prep_for_email
2010-12-07 19:34 ` Junio C Hamano
@ 2010-12-07 19:44 ` Kevin P. Fleming
2010-12-09 13:24 ` [PATCH] Corrected return values in prep_for_email; Alan Raison
2010-12-09 16:03 ` Alan Raison
0 siblings, 2 replies; 9+ messages in thread
From: Kevin P. Fleming @ 2010-12-07 19:44 UTC (permalink / raw
To: Junio C Hamano; +Cc: Alan Raison, git
On 12/07/2010 01:34 PM, Junio C Hamano wrote:
> "Alan Raison"<alan@theraisons.me.uk> writes:
>
>> ---
>> contrib/hooks/post-receive-email | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> No sign-off, no description.
>
> This is a regression introduced by 53cad69 (post-receive-email: ensure
> sent messages are not empty, 2010-09-10), I think.
>
>> diff --git a/contrib/hooks/post-receive-email
>> b/contrib/hooks/post-receive-email
>> index 85724bf..020536d 100755
>> --- a/contrib/hooks/post-receive-email
>> +++ b/contrib/hooks/post-receive-email
>> @@ -150,7 +150,7 @@ prep_for_email()
>> # Anything else (is there anything else?)
>> echo>&2 "*** Unknown type of update to $refname
>> ($rev_type)"
>> echo>&2 "*** - no email generated"
>> - return 0
>> + return 1
>
> This used to "exit 1" before 53cad69 and I agree with the patch that
> signalling error with "return 1" is the right thing to do here.
>
>> ;;
>> esac
>>
>> @@ -166,10 +166,10 @@ prep_for_email()
>> esac
>> echo>&2 "*** $config_name is not set so no email will be
>> sent"
>> echo>&2 "*** for $refname update $oldrev->$newrev"
>> - return 0
>> + return 1
>
> This used to "exit 0" before 53cad69 to cause the program stop before
> sending mails. Again, I agree with the patch that signalling error is the
> right thing to do here.
>
>> fi
>>
>> - return 1
>> + return 0
>
> And this obviously is correct.
>
> Kevin, care to review and Ack? Alan, care to add a few lines of patch
> description and sign-off?
Acked-by: Kevin P. Fleming <kpfleming@digium.com>
Yeah, this is clearly my breakage; our internal version of this script
is so different that it has become hard to backport fixes to the
upstream version... or I just did a terrible job of it.
Alan, while you are in there fixing this, there is a remaining 'exit 0'
in prep_for_email (at line 147) that should be 'return 1' instead.
--
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] Corrected return values in prep_for_email;
2010-12-07 19:44 ` Kevin P. Fleming
@ 2010-12-09 13:24 ` Alan Raison
2010-12-09 15:19 ` Kevin P. Fleming
2010-12-09 16:03 ` Alan Raison
1 sibling, 1 reply; 9+ messages in thread
From: Alan Raison @ 2010-12-09 13:24 UTC (permalink / raw
To: 'Kevin P. Fleming', 'Junio C Hamano'; +Cc: git
>From ebe98d1c682f268b39a7eaf3ef529accbf0ac61c Mon Sep 17 00:00:00 2001
From: Alan Raison <alan@theraisons.me.uk>
Date: Mon, 6 Dec 2010 15:49:21 +0000
Subject: [PATCH] Corrected return values in prep_for_email;
Function was returning 0 for failure and 1 for success which was breaking
the logic in the main loop.
Corrected to return 0 for success, 1 for failure. Function now also returns
in all cases, rather than exiting.
---
contrib/hooks/post-receive-email | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/hooks/post-receive-email
b/contrib/hooks/post-receive-email
index 85724bf..f99ea95 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -144,13 +144,13 @@ prep_for_email()
short_refname=${refname##refs/remotes/}
echo >&2 "*** Push-update of tracking branch,
$refname"
echo >&2 "*** - no email generated."
- exit 0
+ return 1
;;
*)
# Anything else (is there anything else?)
echo >&2 "*** Unknown type of update to $refname
($rev_type)"
echo >&2 "*** - no email generated"
- return 0
+ return 1
;;
esac
@@ -166,10 +166,10 @@ prep_for_email()
esac
echo >&2 "*** $config_name is not set so no email will be
sent"
echo >&2 "*** for $refname update $oldrev->$newrev"
- return 0
+ return 1
fi
- return 1
+ return 0
}
#
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Corrected return values in prep_for_email;
2010-12-09 13:24 ` [PATCH] Corrected return values in prep_for_email; Alan Raison
@ 2010-12-09 15:19 ` Kevin P. Fleming
0 siblings, 0 replies; 9+ messages in thread
From: Kevin P. Fleming @ 2010-12-09 15:19 UTC (permalink / raw
To: Alan Raison; +Cc: 'Junio C Hamano', git
On 12/09/2010 07:24 AM, Alan Raison wrote:
> From ebe98d1c682f268b39a7eaf3ef529accbf0ac61c Mon Sep 17 00:00:00 2001
> From: Alan Raison<alan@theraisons.me.uk>
> Date: Mon, 6 Dec 2010 15:49:21 +0000
> Subject: [PATCH] Corrected return values in prep_for_email;
>
> Function was returning 0 for failure and 1 for success which was breaking
> the logic in the main loop.
>
> Corrected to return 0 for success, 1 for failure. Function now also returns
> in all cases, rather than exiting.
Your commit message will need a Signed-Off-By line, but...
Acked-By: Kevin P. Fleming <kpfleming@digium.com>
> ---
> contrib/hooks/post-receive-email | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/contrib/hooks/post-receive-email
> b/contrib/hooks/post-receive-email
> index 85724bf..f99ea95 100755
> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -144,13 +144,13 @@ prep_for_email()
> short_refname=${refname##refs/remotes/}
> echo>&2 "*** Push-update of tracking branch,
> $refname"
> echo>&2 "*** - no email generated."
> - exit 0
> + return 1
> ;;
> *)
> # Anything else (is there anything else?)
> echo>&2 "*** Unknown type of update to $refname
> ($rev_type)"
> echo>&2 "*** - no email generated"
> - return 0
> + return 1
> ;;
> esac
>
> @@ -166,10 +166,10 @@ prep_for_email()
> esac
> echo>&2 "*** $config_name is not set so no email will be
> sent"
> echo>&2 "*** for $refname update $oldrev->$newrev"
> - return 0
> + return 1
> fi
>
> - return 1
> + return 0
> }
>
> #
--
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] Corrected return values in prep_for_email;
2010-12-07 19:44 ` Kevin P. Fleming
2010-12-09 13:24 ` [PATCH] Corrected return values in prep_for_email; Alan Raison
@ 2010-12-09 16:03 ` Alan Raison
2010-12-09 17:38 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Alan Raison @ 2010-12-09 16:03 UTC (permalink / raw
To: 'Kevin P. Fleming', 'Junio C Hamano'; +Cc: git
Function was returning 0 for failure and 1 for success which was breaking
the logic in the main loop.
Corrected to return 0 for success, 1 for failure. Function now also returns
in all cases, rather than exiting.
Acked-By: Kevin P. Fleming <kpfleming@digium.com>
Signed-Off-By: Alan Raison <alan@theraisons.me.uk>
---
contrib/hooks/post-receive-email | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/hooks/post-receive-email
b/contrib/hooks/post-receive-email
index 85724bf..f99ea95 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -144,13 +144,13 @@ prep_for_email()
short_refname=${refname##refs/remotes/}
echo >&2 "*** Push-update of tracking branch,
$refname"
echo >&2 "*** - no email generated."
- exit 0
+ return 1
;;
*)
# Anything else (is there anything else?)
echo >&2 "*** Unknown type of update to $refname
($rev_type)"
echo >&2 "*** - no email generated"
- return 0
+ return 1
;;
esac
@@ -166,10 +166,10 @@ prep_for_email()
esac
echo >&2 "*** $config_name is not set so no email will be
sent"
echo >&2 "*** for $refname update $oldrev->$newrev"
- return 0
+ return 1
fi
- return 1
+ return 0
}
#
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Corrected return values in prep_for_email;
2010-12-09 16:03 ` Alan Raison
@ 2010-12-09 17:38 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2010-12-09 17:38 UTC (permalink / raw
To: Alan Raison; +Cc: 'Kevin P. Fleming', git
"Alan Raison" <alan@theraisons.me.uk> writes:
> Function was returning 0 for failure and 1 for success which was breaking
> the logic in the main loop.
>
> Corrected to return 0 for success, 1 for failure. Function now also returns
> in all cases, rather than exiting.
Thanks, will apply.
> Acked-By: Kevin P. Fleming <kpfleming@digium.com>
> Signed-Off-By: Alan Raison <alan@theraisons.me.uk>
Just for reference---the order of events is that you signed-off first and
then Kevin acked the result, so the above is backwards.
Also your patch was linewrapped, but I can fix it up---no need to resend,
but please tell your MUA not to corrupt patches next time.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-12-09 17:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 16:32 [PATCH] Corrected return values in post-receive-email.prep_for_email Alan Raison
2010-12-07 16:50 ` Thiago Farina
2010-12-07 17:10 ` Alan Raison
2010-12-07 19:34 ` Junio C Hamano
2010-12-07 19:44 ` Kevin P. Fleming
2010-12-09 13:24 ` [PATCH] Corrected return values in prep_for_email; Alan Raison
2010-12-09 15:19 ` Kevin P. Fleming
2010-12-09 16:03 ` Alan Raison
2010-12-09 17:38 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).