[PATCH] Corrected return values in post-receive-email.prep_for_email

DORMANTno replies

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] Corrected return values in post-receive-email.prep_for_email

From: Alan Raison <hidden>
Date: 2016-06-15 22:50:11

---
 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

Re: [PATCH] Corrected return values in post-receive-email.prep_for_email

From: Thiago Farina <hidden>
Date: 2016-06-15 22:50:11

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 [off-list ref] wrote:
quoted hunk
---
 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

RE: [PATCH] Corrected return values in post-receive-email.prep_for_email

From: Alan Raison <hidden>
Date: 2016-06-15 22:50:11

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 [off-list ref] wrote:
quoted hunk
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help