{"thread":{"id":"2881","subject":"[PATCH] Fix unconditional early exit in cg-fetch","startedAt":"2005-12-19T16:17:36Z","lastAt":"2005-12-20T15:25:07Z","messageCount":3,"participants":["Paolo 'Blaisorblade' Giarrusso","Junio C Hamano","Blaisorblade"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13815","messageId":"20051219161736.18245.98591.stgit@zion.home.lan","threadId":"2881","inReplyTo":null,"subject":"[PATCH] Fix unconditional early exit in cg-fetch","fromName":"Paolo 'Blaisorblade' Giarrusso","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-12-19T16:17:36Z","receivedAt":"2005-12-19T16:17:36Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"\nFrom: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n\nWhen invoking cg-fetch, after fetching tags it exits here, probably for an\noverlooked error handling (at least I corrected it this way).\n\nThis means, for instance, we exit without reporting the tag updates and without\nremoving the \"fetch in progress\" marker - leading to unconditional \"Recovering\nfrom interrupted fetch\" at the very beginning with rsync transport. Indeed, this\nis fixed by this patch.\n\nSigned-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>\n---\n\n cg-fetch |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/cg-fetch b/cg-fetch\nindex a2865ae..a489834 100755\n--- a/cg-fetch\n+++ b/cg-fetch\n@@ -190,8 +190,8 @@ fetch_tags()\n \n \tif [ \"$get\" = \"get_rsync\" ]; then\n \t\t$get -i -s -u -d \"$uri/refs/tags\" \"$_git/refs/tags\" ||\n-\t\t\techo \"unable to get tags list (non-fatal)\" >&2\n-\t\texit $?\n+\t\t\t(echo \"unable to get tags list (non-fatal)\" >&2;\n+\t\t\texit $?)\n \tfi\n \n \tgit-ls-remote --tags \"$uri\" |\n"},{"id":"13831","messageId":"7vpsnso9g8.fsf@assigned-by-dhcp.cox.net","threadId":"2881","inReplyTo":"20051219161736.18245.98591.stgit@zion.home.lan","subject":"Re: [PATCH] Fix unconditional early exit in cg-fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-20T01:15:19Z","receivedAt":"2005-12-20T01:15:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> writes:\n\n>  \tif [ \"$get\" = \"get_rsync\" ]; then\n>  \t\t$get -i -s -u -d \"$uri/refs/tags\" \"$_git/refs/tags\" ||\n> -\t\t\techo \"unable to get tags list (non-fatal)\" >&2\n> -\t\texit $?\n> +\t\t\t(echo \"unable to get tags list (non-fatal)\" >&2;\n> +\t\t\texit $?)\n>  \tfi\n\nWhy would you want a subshell that exits with a non-zero status\nwhen nobody is checking that status anyway?\n\nI suspect removing \"exit $?\" would suffice, if that condition is\nnon-fatal as the message says...\n"},{"id":"13838","messageId":"200512201625.09767.blaisorblade@yahoo.it","threadId":"2881","inReplyTo":"7vpsnso9g8.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix unconditional early exit in cg-fetch","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-12-20T15:25:07Z","receivedAt":"2005-12-20T15:25:07Z","isPatch":true,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Tuesday 20 December 2005 02:15, Junio C Hamano wrote:\n> Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> writes:\n> >  \tif [ \"$get\" = \"get_rsync\" ]; then\n> >  \t\t$get -i -s -u -d \"$uri/refs/tags\" \"$_git/refs/tags\" ||\n> > -\t\t\techo \"unable to get tags list (non-fatal)\" >&2\n> > -\t\texit $?\n> > +\t\t\t(echo \"unable to get tags list (non-fatal)\" >&2;\n> > +\t\t\texit $?)\n> >  \tfi\n\n> Why would you want a subshell that exits with a non-zero status\n> when nobody is checking that status anyway?\n\nArgh, I should have used a proper conditional statement... I always forget \nbash is not Perl.\n\n> I suspect removing \"exit $?\" would suffice, if that condition is\n> non-fatal as the message says...\n\nLikely you need to skip git-ls-remote (not sure however, but it's an \nexceptional condition).\n\nreturn $? would be IMHO also fine - the caller is then free to ignore the \nreturn code.\n\nI'm then resending the patch done the second way - feel free to merge any \nversion.\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"}]}