diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-12-21 10:59:05 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-12-21 10:59:05 -0800 |
commit | 5d35d72fc3030360d9b717a4c755e9ec877d00e5 (patch) | |
tree | 2b5884c11d983304e5a5460624fe941c2aa7d64b /submodule-config.c | |
parent | c3ee2e2c9deb1e7846e864494cdb2fbc7bb1a285 (diff) | |
parent | d34141cd08fb1c6938eae329a7c3122b05e9eb01 (diff) | |
download | git-5d35d72fc3030360d9b717a4c755e9ec877d00e5.tar.gz git-5d35d72fc3030360d9b717a4c755e9ec877d00e5.tar.xz |
Merge branch 'mc/push-recurse-submodules-config'
Add new config to avoid typing "--recurse-submodules" on each push.
* mc/push-recurse-submodules-config:
push: follow the "last one wins" convention for --recurse-submodules
push: test that --recurse-submodules on command line overrides config
push: add recurseSubmodules config option
Diffstat (limited to 'submodule-config.c')
-rw-r--r-- | submodule-config.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/submodule-config.c b/submodule-config.c index afe0ea815..fe8ceabf3 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) { |