Re: [PATCH] Fix unconditional early exit in cg-fetch

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

Re: [PATCH] Fix unconditional early exit in cg-fetch

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:15

Paolo 'Blaisorblade' Giarrusso [off-list ref] writes:
 	if [ "$get" = "get_rsync" ]; then
 		$get -i -s -u -d "$uri/refs/tags" "$_git/refs/tags" ||
-			echo "unable to get tags list (non-fatal)" >&2
-		exit $?
+			(echo "unable to get tags list (non-fatal)" >&2;
+			exit $?)
 	fi
Why would you want a subshell that exits with a non-zero status
when nobody is checking that status anyway?

I suspect removing "exit $?" would suffice, if that condition is
non-fatal as the message says...

Re: [PATCH] Fix unconditional early exit in cg-fetch

From: Blaisorblade <hidden>
Date: 2016-06-15 22:42:15

On Tuesday 20 December 2005 02:15, Junio C Hamano wrote:
Paolo 'Blaisorblade' Giarrusso [off-list ref] writes:
quoted
 	if [ "$get" = "get_rsync" ]; then
 		$get -i -s -u -d "$uri/refs/tags" "$_git/refs/tags" ||
-			echo "unable to get tags list (non-fatal)" >&2
-		exit $?
+			(echo "unable to get tags list (non-fatal)" >&2;
+			exit $?)
 	fi
Why would you want a subshell that exits with a non-zero status
when nobody is checking that status anyway?
Argh, I should have used a proper conditional statement... I always forget 
bash is not Perl.
I suspect removing "exit $?" would suffice, if that condition is
non-fatal as the message says...
Likely you need to skip git-ls-remote (not sure however, but it's an 
exceptional condition).

return $? would be IMHO also fine - the caller is then free to ignore the 
return code.

I'm then resending the patch done the second way - feel free to merge any 
version.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help