{"thread":{"id":"7555","subject":"[PATCH 2/2] git-push to multiple locations does not stop at the first failure","startedAt":"2007-04-07T06:04:53Z","lastAt":"2007-04-07T06:04:53Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"38839","messageId":"7vhcrsg1oa.fsf@assigned-by-dhcp.cox.net","threadId":"7555","inReplyTo":null,"subject":"[PATCH 2/2] git-push to multiple locations does not stop at the first failure","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-07T06:04:53Z","receivedAt":"2007-04-07T06:04:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When pushing into multiple repositories with git push, via\nmultiple URL in .git/remotes/$shorthand or multiple url\nvariables in [remote \"$shorthand\"] section, we used to stop upon\nthe first failure.  Continue the operation and report the\nfailure at the end.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * This matters a bit to me, as I have 'builders' shorthand that\n   pushes into two bochs images (one for FC5, another for\n   OpenBSD) I installed on my wife's machine, so that I can cut\n   a release and run portability testing.  Usually however I do\n   not start the OpenBSD image automatically there.\n\n builtin-push.c |   15 ++++++++-------\n 1 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 23143be..cb78401 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -297,7 +297,7 @@ static int read_config(const char *repo, const char *uri[MAX_URI])\n static int do_push(const char *repo)\n {\n \tconst char *uri[MAX_URI];\n-\tint i, n;\n+\tint i, n, errs;\n \tint common_argc;\n \tconst char **argv;\n \tint argc;\n@@ -317,6 +317,7 @@ static int do_push(const char *repo)\n \t\targv[argc++] = receivepack;\n \tcommon_argc = argc;\n \n+\terrs = 0;\n \tfor (i = 0; i < n; i++) {\n \t\tint err;\n \t\tint dest_argc = common_argc;\n@@ -343,19 +344,19 @@ static int do_push(const char *repo)\n \t\terror(\"failed to push to '%s'\", uri[i]);\n \t\tswitch (err) {\n \t\tcase -ERR_RUN_COMMAND_FORK:\n-\t\t\tdie(\"unable to fork for %s\", sender);\n+\t\t\terror(\"unable to fork for %s\", sender);\n \t\tcase -ERR_RUN_COMMAND_EXEC:\n-\t\t\tdie(\"unable to exec %s\", sender);\n+\t\t\terror(\"unable to exec %s\", sender);\n+\t\t\tbreak;\n \t\tcase -ERR_RUN_COMMAND_WAITPID:\n \t\tcase -ERR_RUN_COMMAND_WAITPID_WRONG_PID:\n \t\tcase -ERR_RUN_COMMAND_WAITPID_SIGNAL:\n \t\tcase -ERR_RUN_COMMAND_WAITPID_NOEXIT:\n-\t\t\tdie(\"%s died with strange error\", sender);\n-\t\tdefault:\n-\t\t\treturn -err;\n+\t\t\terror(\"%s died with strange error\", sender);\n \t\t}\n+\t\terrs++;\n \t}\n-\treturn 0;\n+\treturn !!errs;\n }\n \n int cmd_push(int argc, const char **argv, const char *prefix)\n"}]}