X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=submodule-config.c;h=fe8ceabf3009db672d4d2dc5121123961c298212;hb=b33a15b08131514b593015cb3e719faf9db20208;hp=afe0ea81565a5675bcc3eff3199059240bbf95ee;hpb=0c83680e9c047170614fb08ef222ea4f460e514d;p=thirdparty%2Fgit.git diff --git a/submodule-config.c b/submodule-config.c index afe0ea8156..fe8ceabf30 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -228,6 +228,35 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg) return parse_fetch_recurse(opt, arg, 1); } +static int parse_push_recurse(const char *opt, const char *arg, + int die_on_error) +{ + switch (git_config_maybe_bool(opt, arg)) { + case 1: + /* There's no simple "on" value when pushing */ + if (die_on_error) + die("bad %s argument: %s", opt, arg); + else + return RECURSE_SUBMODULES_ERROR; + case 0: + return RECURSE_SUBMODULES_OFF; + default: + if (!strcmp(arg, "on-demand")) + return RECURSE_SUBMODULES_ON_DEMAND; + else if (!strcmp(arg, "check")) + return RECURSE_SUBMODULES_CHECK; + else if (die_on_error) + die("bad %s argument: %s", opt, arg); + else + return RECURSE_SUBMODULES_ERROR; + } +} + +int parse_push_recurse_submodules_arg(const char *opt, const char *arg) +{ + return parse_push_recurse(opt, arg, 1); +} + static void warn_multiple_config(const unsigned char *commit_sha1, const char *name, const char *option) {