From 39878b0cb7d0afc3ff4c8adb715815f116188178 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 6 Apr 2007 23:04:55 -0700 Subject: git-push reports the URL after failing. This came up on #git when somebody was getting 'unable to create ./objects/tmp_oXXXX' but sweared he had write permission to that directory. It turned out that the repository URL was changed and he was accessing a repository he does not have a write permission anymore. I am not sure how much this would have helped somebody who believed he was accessing location when the permission of that location was changed while he was looking the other way, though. But giving more information on the error path would be better, and the next change would be helped with this as well. Signed-off-by: Junio C Hamano --- builtin-push.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'builtin-push.c') diff --git a/builtin-push.c b/builtin-push.c index 70b1168fa..23143be54 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -339,6 +339,8 @@ static int do_push(const char *repo) err = run_command_v_opt(argv, RUN_GIT_CMD); if (!err) continue; + + error("failed to push to '%s'", uri[i]); switch (err) { case -ERR_RUN_COMMAND_FORK: die("unable to fork for %s", sender); -- cgit v1.2.1 From fd1d1b05e937ff3164be38b111e5d76d592ee548 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 6 Apr 2007 23:04:53 -0700 Subject: 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 --- builtin-push.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'builtin-push.c') diff --git a/builtin-push.c b/builtin-push.c index 23143be54..cb78401c9 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) -- cgit v1.2.1