update submodules: add a config option to determine if submodules are updated

In later patches we introduce the options and flag for commands that modify the working directory, e.g. git-checkout. Have a central place to store such settings whether we want to update a submodule. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 14, 2017 at 14:46 UTC cf055e465f6febedb8189407a901042814d6b5d8
2 files changed +7
submodule.c
+6
@@ -17,6 +17,7 @@
17 #include "worktree.h"
18
19 static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
20 +static int config_update_recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
21 static int parallel_jobs = 1;
22 static struct string_list changed_submodule_paths = STRING_LIST_INIT_NODUP;
23 static int initialized_fetch_ref_tips;
@@ -542,6 +543,11 @@ void set_config_fetch_recurse_submodules(int value)
543 config_fetch_recurse_submodules = value;
544 }
545
546 +void set_config_update_recurse_submodules(int value)
547 +{
548 + config_update_recurse_submodules = value;
549 +}
550 +
551 static int has_remote(const char *refname, const struct object_id *oid,
552 int flags, void *cb_data)
553 {
submodule.h
+1
@@ -64,6 +64,7 @@ extern void show_submodule_inline_diff(FILE *f, const char *path,
64 const char *del, const char *add, const char *reset,
65 const struct diff_options *opt);
66 extern void set_config_fetch_recurse_submodules(int value);
67 +extern void set_config_update_recurse_submodules(int value);
68 extern void check_for_new_submodule_commits(unsigned char new_sha1[20]);
69 extern int fetch_populated_submodules(const struct argv_array *options,
70 const char *prefix, int command_line_option,