diff options
Diffstat (limited to 'builtin/push.c')
-rw-r--r-- | builtin/push.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/builtin/push.c b/builtin/push.c index 7a67398124..59d4485603 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -1,6 +1,7 @@ /* * "git push" */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "branch.h" @@ -13,7 +14,6 @@ #include "transport.h" #include "parse-options.h" #include "pkt-line.h" -#include "repository.h" #include "submodule.h" #include "submodule-config.h" #include "send-pack.h" @@ -72,13 +72,15 @@ static void refspec_append_mapped(struct refspec *refspec, const char *ref, const char *branch_name; if (remote->push.nr) { - struct refspec_item query; - memset(&query, 0, sizeof(struct refspec_item)); - query.src = matched->name; + struct refspec_item query = { + .src = matched->name, + }; + if (!query_refspecs(&remote->push, &query) && query.dst) { refspec_appendf(refspec, "%s%s:%s", query.force ? "+" : "", query.src, query.dst); + free(query.dst); return; } } @@ -546,7 +548,10 @@ static int git_push_config(const char *k, const char *v, return git_default_config(k, v, ctx, NULL); } -int cmd_push(int argc, const char **argv, const char *prefix) +int cmd_push(int argc, + const char **argv, + const char *prefix, + struct repository *repository UNUSED) { int flags = 0; int tags = 0; @@ -664,6 +669,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) rc = do_push(flags, push_options, remote); string_list_clear(&push_options_cmdline, 0); string_list_clear(&push_options_config, 0); + clear_cas_option(&cas); if (rc == -1) usage_with_options(push_usage, options); else |