X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=builtin%2Fpush.c;h=03846e83795c477c8e802d078c5a5ed77140d550;hb=288a74bcd28229a00c3632f18cba92dbfdf73ee9;hp=3bb9d6b7e63b3e3082023c3d333c11757df6fbda;hpb=31add46823fe926e85efbfeab865e366018b33b4;p=thirdparty%2Fgit.git diff --git a/builtin/push.c b/builtin/push.c index 3bb9d6b7e6..03846e8379 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -2,6 +2,7 @@ * "git push" */ #include "cache.h" +#include "config.h" #include "refs.h" #include "run-command.h" #include "builtin.h" @@ -194,15 +195,18 @@ static void setup_push_upstream(struct remote *remote, struct branch *branch, die_push_simple(branch, remote); } - strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src); + strbuf_addf(&refspec, "%s:%s", branch->refname, branch->merge[0]->src); add_refspec(refspec.buf); } static void setup_push_current(struct remote *remote, struct branch *branch) { + struct strbuf refspec = STRBUF_INIT; + if (!branch) die(_(message_detached_head_die), remote->name); - add_refspec(branch->name); + strbuf_addf(&refspec, "%s:%s", branch->refname, branch->refname); + add_refspec(refspec.buf); } static int is_workflow_triangular(struct remote *remote) @@ -495,6 +499,10 @@ static int git_push_config(const char *k, const char *v, void *cb) const char *value; if (!git_config_get_value("push.recursesubmodules", &value)) recurse_submodules = parse_push_recurse_submodules_arg(k, value); + } else if (!strcmp(k, "submodule.recurse")) { + int val = git_config_bool(k, v) ? + RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF; + recurse_submodules = val; } return git_default_config(k, v, NULL); @@ -507,8 +515,8 @@ int cmd_push(int argc, const char **argv, const char *prefix) int push_cert = -1; int rc; const char *repo = NULL; /* default repository */ - static struct string_list push_options = STRING_LIST_INIT_DUP; - static struct string_list_item *item; + struct string_list push_options = STRING_LIST_INIT_DUP; + const struct string_list_item *item; struct option options[] = { OPT__VERBOSITY(&verbosity), @@ -565,6 +573,8 @@ int cmd_push(int argc, const char **argv, const char *prefix) flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK; else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) flags |= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND; + else if (recurse_submodules == RECURSE_SUBMODULES_ONLY) + flags |= TRANSPORT_RECURSE_SUBMODULES_ONLY; if (tags) add_refspec("refs/tags/*"); @@ -579,6 +589,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) die(_("push options must not have new line characters")); rc = do_push(repo, flags, &push_options); + string_list_clear(&push_options, 0); if (rc == -1) usage_with_options(push_usage, options); else