diff options
author | Antonio Ospite <ao2@ao2.it> | 2018-06-26 12:47:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-26 12:56:12 -0700 |
commit | 057449978efe3e803d1d1ec382e1f238a405a833 (patch) | |
tree | 7b2df9fccfa6f1e581f23c8255090773b1110be7 /submodule-config.c | |
parent | 71a6953d164012647fcb9682e4e705ba61b95929 (diff) | |
download | git-057449978efe3e803d1d1ec382e1f238a405a833.tar.gz |
submodule-config: add helper to get 'update-clone' config from .gitmodules
Add a helper function to make it clearer that retrieving 'update-clone'
configuration from the .gitmodules file is a special case supported
solely for backward compatibility purposes.
This change removes one direct use of 'config_from_gitmodules' for
options not strictly related to submodules: "submodule.fetchjobs" does
not describe a property of a submodule, but a behavior of other commands
when dealing with submodules, so it does not really belong to the
.gitmodules file.
This is in the effort to communicate better that .gitmodules is not to
be used as a mechanism to store arbitrary configuration in the
repository that any command can retrieve.
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule-config.c')
-rw-r--r-- | submodule-config.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/submodule-config.c b/submodule-config.c index f44d6a7775..9a2b13d8bc 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -716,3 +716,17 @@ void fetch_config_from_gitmodules(int *max_children, int *recurse_submodules) }; config_from_gitmodules(gitmodules_fetch_config, &config); } + +static int gitmodules_update_clone_config(const char *var, const char *value, + void *cb) +{ + int *max_jobs = cb; + if (!strcmp(var, "submodule.fetchjobs")) + *max_jobs = parse_submodule_fetchjobs(var, value); + return 0; +} + +void update_clone_config_from_gitmodules(int *max_jobs) +{ + config_from_gitmodules(gitmodules_update_clone_config, &max_jobs); +} |