git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] git-push to multiple locations does not stop at the first failure

From
Junio C Hamano <junkio@cox.net>
Date
Apr 7, 2007, 06:04 UTC
Message-ID
<7vhcrsg1oa.fsf@assigned-by-dhcp.cox.net>

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>
---
 * This matters a bit to me, as I have 'builders' shorthand that
   pushes into two bochs images (one for FC5, another for
   OpenBSD) I installed on my wife's machine, so that I can cut
   a release and run portability testing.  Usually however I do
   not start the OpenBSD image automatically there.
 builtin-push.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/builtin-push.c b/builtin-push.c
index 23143be..cb78401 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -297,7 +297,7 @@ static int read_config(const char *repo, const char *uri[MAX_URI])
 static int do_push(const char *repo)
 {
 	const char *uri[MAX_URI];
-	int i, n;
+	int i, n, errs;
 	int common_argc;
 	const char **argv;
 	int argc;
@@ -317,6 +317,7 @@ static int do_push(const char *repo)
 		argv[argc++] = receivepack;
 	common_argc = argc;
 
+	errs = 0;
 	for (i = 0; i < n; i++) {
 		int err;
 		int dest_argc = common_argc;
@@ -343,19 +344,19 @@ static int do_push(const char *repo)
 		error("failed to push to '%s'", uri[i]);
 		switch (err) {
 		case -ERR_RUN_COMMAND_FORK:
-			die("unable to fork for %s", sender);
+			error("unable to fork for %s", sender);
 		case -ERR_RUN_COMMAND_EXEC:
-			die("unable to exec %s", sender);
+			error("unable to exec %s", sender);
+			break;
 		case -ERR_RUN_COMMAND_WAITPID:
 		case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
 		case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
 		case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
-			die("%s died with strange error", sender);
-		default:
-			return -err;
+			error("%s died with strange error", sender);
 		}
+		errs++;
 	}
-	return 0;
+	return !!errs;
 }
 
 int cmd_push(int argc, const char **argv, const char *prefix)
Message 1 of 1 in “git-push to multiple locations does not stop at the first failure”
  1. 2/2 git-push to multiple locations does not stop at the first failureJunio C Hamano, Apr 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.