diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-09-02 13:07:58 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-09-02 13:07:58 -0700 |
commit | c63750abc30c017d13d6be9e5a90d6d2c56b60b6 (patch) | |
tree | 5c1b9704a3e4404fd330153bc5dc8fa5da35b621 /builtin | |
parent | 497dff9138189b405016ff9e1f96554f1c44b1e7 (diff) | |
parent | d2b17b3220cbd75b1c8e2aa6cfdc5c121749c97d (diff) | |
download | git-c63750abc30c017d13d6be9e5a90d6d2c56b60b6.tar.gz git-c63750abc30c017d13d6be9e5a90d6d2c56b60b6.tar.xz |
Merge branch 'fg/submodule-ff-check-before-push'
* fg/submodule-ff-check-before-push:
push: Don't push a repository with unpushed submodules
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/push.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/builtin/push.c b/builtin/push.c index 9cebf9ea2..35cce532f 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -8,6 +8,7 @@ #include "remote.h" #include "transport.h" #include "parse-options.h" +#include "submodule.h" static const char * const push_usage[] = { "git push [<options>] [<repository> [<refspec>...]]", @@ -219,6 +220,21 @@ static int do_push(const char *repo, int flags) return !!errs; } +static int option_parse_recurse_submodules(const struct option *opt, + const char *arg, int unset) +{ + int *flags = opt->value; + if (arg) { + if (!strcmp(arg, "check")) + *flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK; + else + die("bad %s argument: %s", opt->long_name, arg); + } else + die("option %s needs an argument (check)", opt->long_name); + + return 0; +} + int cmd_push(int argc, const char **argv, const char *prefix) { int flags = 0; @@ -236,6 +252,9 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_BIT('n' , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN), OPT_BIT( 0, "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN), OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE), + { OPTION_CALLBACK, 0, "recurse-submodules", &flags, "check", + "controls recursive pushing of submodules", + PARSE_OPT_OPTARG, option_parse_recurse_submodules }, OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"), OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", "receive pack program"), OPT_STRING( 0 , "exec", &receivepack, "receive-pack", "receive pack program"), |