git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix unconditional early exit in cg-fetch
@ 2005-12-19 16:17 Paolo 'Blaisorblade' Giarrusso
  2005-12-20  1:15 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo 'Blaisorblade' Giarrusso @ 2005-12-19 16:17 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

When invoking cg-fetch, after fetching tags it exits here, probably for an
overlooked error handling (at least I corrected it this way).

This means, for instance, we exit without reporting the tag updates and without
removing the "fetch in progress" marker - leading to unconditional "Recovering
from interrupted fetch" at the very beginning with rsync transport. Indeed, this
is fixed by this patch.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 cg-fetch |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cg-fetch b/cg-fetch
index a2865ae..a489834 100755
--- a/cg-fetch
+++ b/cg-fetch
@@ -190,8 +190,8 @@ fetch_tags()
 
 	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
 
 	git-ls-remote --tags "$uri" |

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix unconditional early exit in cg-fetch
  2005-12-19 16:17 [PATCH] Fix unconditional early exit in cg-fetch Paolo 'Blaisorblade' Giarrusso
@ 2005-12-20  1:15 ` Junio C Hamano
  2005-12-20 15:25   ` Blaisorblade
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2005-12-20  1:15 UTC (permalink / raw)
  To: Paolo 'Blaisorblade' Giarrusso; +Cc: Petr Baudis, git

Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 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...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix unconditional early exit in cg-fetch
  2005-12-20  1:15 ` Junio C Hamano
@ 2005-12-20 15:25   ` Blaisorblade
  0 siblings, 0 replies; 3+ messages in thread
From: Blaisorblade @ 2005-12-20 15:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git

On Tuesday 20 December 2005 02:15, Junio C Hamano wrote:
> Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 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?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-20 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-19 16:17 [PATCH] Fix unconditional early exit in cg-fetch Paolo 'Blaisorblade' Giarrusso
2005-12-20  1:15 ` Junio C Hamano
2005-12-20 15:25   ` Blaisorblade

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 NNTP newsgroup(s).