X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=builtin-push.c;h=66b94078229c09d8105fcd7f5800a2cba567c972;hp=06d06ff310da61d71cc11bf0ac9245228a6cc10b;hb=HEAD;hpb=6b16250a4551682b026b2592e44077ffa5fbdf2a diff --git a/builtin-push.c b/builtin-push.c index 06d06ff3..66b94078 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -72,7 +72,7 @@ static int get_remotes_uri(const char *repo, const char *uri[MAX_URI]) { int n = 0; FILE *f = fopen(git_path("remotes/%s", repo), "r"); - int has_explicit_refspec = refspec_nr; + int has_explicit_refspec = refspec_nr || all || tags; if (!f) return -1; @@ -144,7 +144,7 @@ static int get_config_remotes_uri(const char *repo, const char *uri[MAX_URI]) config_repo = repo; config_current_uri = 0; config_uri = uri; - config_get_refspecs = !refspec_nr; + config_get_refspecs = !(refspec_nr || all || tags); git_config(get_remote_config); return config_current_uri; @@ -214,7 +214,7 @@ static int do_push(const char *repo) { const char *uri[MAX_URI]; int i, n; - int remote; + int common_argc; const char **argv; int argc; @@ -231,23 +231,25 @@ static int do_push(const char *repo) argv[argc++] = "--force"; if (execute) argv[argc++] = execute; - if (thin) - argv[argc++] = "--thin"; - remote = argc; - argv[argc++] = "dummy-remote"; - while (refspec_nr--) - argv[argc++] = *refspec++; - argv[argc] = NULL; + common_argc = argc; for (i = 0; i < n; i++) { int error; + int dest_argc = common_argc; + int dest_refspec_nr = refspec_nr; + const char **dest_refspec = refspec; const char *dest = uri[i]; const char *sender = "git-send-pack"; if (!strncmp(dest, "http://", 7) || !strncmp(dest, "https://", 8)) sender = "git-http-push"; + else if (thin) + argv[dest_argc++] = "--thin"; argv[0] = sender; - argv[remote] = dest; + argv[dest_argc++] = dest; + while (dest_refspec_nr--) + argv[dest_argc++] = *dest_refspec++; + argv[dest_argc] = NULL; error = run_command_v(argc, argv); if (!error) continue;