Skip to content

Commit 5bcbc7f

Browse files
author
Junio C Hamano
committed
Merge branch 'jc/push'
* jc/push: git-push to multiple locations does not stop at the first failure git-push reports the URL after failing.
2 parents 58fe516 + fd1d1b0 commit 5bcbc7f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

builtin-push.c

Lines changed: 10 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;
@@ -339,21 +340,23 @@ static int do_push(const char *repo)
339340
err = run_command_v_opt(argv, RUN_GIT_CMD);
340341
if (!err)
341342
continue;
343+
344+
error("failed to push to '%s'", uri[i]);
342345
switch (err) {
343346
case -ERR_RUN_COMMAND_FORK:
344-
die("unable to fork for %s", sender);
347+
error("unable to fork for %s", sender);
345348
case -ERR_RUN_COMMAND_EXEC:
346-
die("unable to exec %s", sender);
349+
error("unable to exec %s", sender);
350+
break;
347351
case -ERR_RUN_COMMAND_WAITPID:
348352
case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
349353
case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
350354
case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
351-
die("%s died with strange error", sender);
352-
default:
353-
return -err;
355+
error("%s died with strange error", sender);
354356
}
357+
errs++;
355358
}
356-
return 0;
359+
return !!errs;
357360
}
358361

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

0 commit comments

Comments
 (0)