Skip to content

Commit fd1d1b0

Browse files
author
Junio C Hamano
committed
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 <[email protected]>
1 parent 39878b0 commit fd1d1b0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

builtin-push.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int read_config(const char *repo, const char *uri[MAX_URI])
297297
static int do_push(const char *repo)
298298
{
299299
const char *uri[MAX_URI];
300-
int i, n;
300+
int i, n, errs;
301301
int common_argc;
302302
const char **argv;
303303
int argc;
@@ -317,6 +317,7 @@ static int do_push(const char *repo)
317317
argv[argc++] = receivepack;
318318
common_argc = argc;
319319

320+
errs = 0;
320321
for (i = 0; i < n; i++) {
321322
int err;
322323
int dest_argc = common_argc;
@@ -343,19 +344,19 @@ static int do_push(const char *repo)
343344
error("failed to push to '%s'", uri[i]);
344345
switch (err) {
345346
case -ERR_RUN_COMMAND_FORK:
346-
die("unable to fork for %s", sender);
347+
error("unable to fork for %s", sender);
347348
case -ERR_RUN_COMMAND_EXEC:
348-
die("unable to exec %s", sender);
349+
error("unable to exec %s", sender);
350+
break;
349351
case -ERR_RUN_COMMAND_WAITPID:
350352
case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
351353
case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
352354
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);
356356
}
357+
errs++;
357358
}
358-
return 0;
359+
return !!errs;
359360
}
360361

361362
int cmd_push(int argc, const char **argv, const char *prefix)

0 commit comments

Comments
 (0)