git-push to multiple locations does not stop at the first failure
When pushing into multiple repositories with git push, via multiple URL in .git/remotes/$shorthand or multiple url variables in [remote "$shorthand"] section, we used to stop upon the first failure. Continue the operation and report the failure at the end. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Apr 6, 2007 at 23:04 UTC
fd1d1b05e937ff3164be38b111e5d76d592ee548
1 file changed
+8
-7
builtin-push.c
+8
-7
@@ -297,7 +297,7 @@ static int read_config(const char *repo, const char *uri[MAX_URI])
297
static int do_push(const char *repo)
298
{
299
const char *uri[MAX_URI];
300
- int i, n;
300
+ int i, n, errs;
301
int common_argc;
302
const char **argv;
303
int argc;
@@ -317,6 +317,7 @@ static int do_push(const char *repo)
317
argv[argc++] = receivepack;
318
common_argc = argc;
319
320
+ errs = 0;
321
for (i = 0; i < n; i++) {
322
int err;
323
int dest_argc = common_argc;
@@ -343,19 +344,19 @@ static int do_push(const char *repo)
344
error("failed to push to '%s'", uri[i]);
345
switch (err) {
346
case -ERR_RUN_COMMAND_FORK:
346
- die("unable to fork for %s", sender);
347
+ error("unable to fork for %s", sender);
348
case -ERR_RUN_COMMAND_EXEC:
348
- die("unable to exec %s", sender);
349
+ error("unable to exec %s", sender);
350
+ break;
351
case -ERR_RUN_COMMAND_WAITPID:
352
case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
353
case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
354
case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
353
- die("%s died with strange error", sender);
354
- default:
355
- return -err;
355
+ error("%s died with strange error", sender);
356
}
357
+ errs++;
358
}
358
- return 0;
359
+ return !!errs;
360
}
361
362
int cmd_push(int argc, const char **argv, const char *prefix)