{"thread":{"id":"56227","subject":"[GSoC] [PATCH v4] submodule--helper: introduce add-config subcommand","startedAt":"2021-08-06T14:04:55Z","lastAt":"2021-08-07T06:13:25Z","messageCount":2,"participants":["Atharva Raykar"],"isPatch":true,"patchVersion":4,"patchTotal":null},"messages":[{"id":"432176","messageId":"20210806140431.92018-1-raykar.ath@gmail.com","threadId":"56227","inReplyTo":null,"subject":"[GSoC] [PATCH v4] submodule--helper: introduce add-config subcommand","fromName":"Atharva Raykar","fromEmail":"raykar.ath@gmail.com","sentAt":"2021-08-06T14:04:31Z","receivedAt":"2021-08-06T14:04:55Z","isPatch":true,"sender":{"key":"raykar.ath@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24277692?v=4"},"body":"Add a new \"add-config\" subcommand to `git submodule--helper` with the\ngoal of converting part of the shell code in git-submodule.sh related to\n`git submodule add` into C code. This new subcommand sets the\nconfiguration variables of a newly added submodule, by registering the\nurl in local git config, as well as the submodule name and path in the\n.gitmodules file. It also sets 'submodule.<name>.active' to \"true\" if\nthe submodule path has not already been covered by any pathspec\nspecified in 'submodule.active'.\n\nThis is meant to be a faithful conversion from shell to C, although we\nadd comments to areas that could be improved in future patches, after\nthe conversion has settled.\n\nSigned-off-by: Atharva Raykar <raykar.ath@gmail.com>\nMentored-by: Christian Couder <christian.couder@gmail.com>\nMentored-by: Shourya Shukla <periperidip@gmail.com>\nBased-on-patch-by: Shourya Shukla <periperidip@gmail.com>\nBased-on-patch-by: Prathamesh Chavan <pc44800@gmail.com>\n---\n\nChanges since v3:\nAddress style nit.\n\nRange-diff against v3:\n1:  be520ad028 ! 1:  b3df2a5e6c submodule--helper: introduce add-config subcommand\n    @@ builtin/submodule--helper.c: static int add_clone(int argc, const char **argv, c\n     +\t    config_submodule_in_gitmodules(add_data->sm_name, \"url\", add_data->repo))\n     +\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n     +\n    -+\tif (add_data->branch)\n    ++\tif (add_data->branch) {\n     +\t\tif (config_submodule_in_gitmodules(add_data->sm_name,\n     +\t\t\t\t\t\t   \"branch\", add_data->branch))\n     +\t\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n    ++\t}\n     +\n     +\tadd_gitmodules.git_cmd = 1;\n     +\tstrvec_pushl(&add_gitmodules.args,\n\n builtin/submodule--helper.c | 129 ++++++++++++++++++++++++++++++++++++\n git-submodule.sh            |  28 +-------\n submodule.c                 |   5 ++\n 3 files changed, 135 insertions(+), 27 deletions(-)\n\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 862053c9f2..abf1ec2000 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -2936,6 +2936,134 @@ static int add_clone(int argc, const char **argv, const char *prefix)\n \treturn 0;\n }\n \n+static int config_submodule_in_gitmodules(const char *name, const char *var, const char *value)\n+{\n+\tchar *key;\n+\tint ret;\n+\n+\tif (!is_writing_gitmodules_ok())\n+\t\tdie(_(\"please make sure that the .gitmodules file is in the working tree\"));\n+\n+\tkey = xstrfmt(\"submodule.%s.%s\", name, var);\n+\tret = config_set_in_gitmodules_file_gently(key, value);\n+\tfree(key);\n+\n+\treturn ret;\n+}\n+\n+static void configure_added_submodule(struct add_data *add_data)\n+{\n+\tchar *key;\n+\tchar *val = NULL;\n+\tstruct child_process add_submod = CHILD_PROCESS_INIT;\n+\tstruct child_process add_gitmodules = CHILD_PROCESS_INIT;\n+\n+\tkey = xstrfmt(\"submodule.%s.url\", add_data->sm_name);\n+\tgit_config_set_gently(key, add_data->realrepo);\n+\tfree(key);\n+\n+\tadd_submod.git_cmd = 1;\n+\tstrvec_pushl(&add_submod.args, \"add\",\n+\t\t     \"--no-warn-embedded-repo\", NULL);\n+\tif (add_data->force)\n+\t\tstrvec_push(&add_submod.args, \"--force\");\n+\tstrvec_pushl(&add_submod.args, \"--\", add_data->sm_path, NULL);\n+\n+\tif (run_command(&add_submod))\n+\t\tdie(_(\"Failed to add submodule '%s'\"), add_data->sm_path);\n+\n+\tif (config_submodule_in_gitmodules(add_data->sm_name, \"path\", add_data->sm_path) ||\n+\t    config_submodule_in_gitmodules(add_data->sm_name, \"url\", add_data->repo))\n+\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n+\n+\tif (add_data->branch) {\n+\t\tif (config_submodule_in_gitmodules(add_data->sm_name,\n+\t\t\t\t\t\t   \"branch\", add_data->branch))\n+\t\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n+\t}\n+\n+\tadd_gitmodules.git_cmd = 1;\n+\tstrvec_pushl(&add_gitmodules.args,\n+\t\t     \"add\", \"--force\", \"--\", \".gitmodules\", NULL);\n+\n+\tif (run_command(&add_gitmodules))\n+\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n+\n+\t/*\n+\t * NEEDSWORK: In a multi-working-tree world this needs to be\n+\t * set in the per-worktree config.\n+\t */\n+\t/*\n+\t * NEEDSWORK: In the longer run, we need to get rid of this\n+\t * pattern of querying \"submodule.active\" before calling\n+\t * is_submodule_active(), since that function needs to find\n+\t * out the value of \"submodule.active\" again anyway.\n+\t */\n+\tif (!git_config_get_string(\"submodule.active\", &val) && val) {\n+\t\t/*\n+\t\t * If the submodule being added isn't already covered by the\n+\t\t * current configured pathspec, set the submodule's active flag\n+\t\t */\n+\t\tif (!is_submodule_active(the_repository, add_data->sm_path)) {\n+\t\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n+\t\t\tgit_config_set_gently(key, \"true\");\n+\t\t\tfree(key);\n+\t\t}\n+\t} else {\n+\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n+\t\tgit_config_set_gently(key, \"true\");\n+\t\tfree(key);\n+\t}\n+}\n+\n+static int add_config(int argc, const char **argv, const char *prefix)\n+{\n+\tint force = 0;\n+\tstruct add_data add_data = ADD_DATA_INIT;\n+\n+\tstruct option options[] = {\n+\t\tOPT_STRING('b', \"branch\", &add_data.branch,\n+\t\t\t   N_(\"branch\"),\n+\t\t\t   N_(\"branch of repository to store in \"\n+\t\t\t      \"the submodule configuration\")),\n+\t\tOPT_STRING(0, \"url\", &add_data.repo,\n+\t\t\t   N_(\"string\"),\n+\t\t\t   N_(\"url to clone submodule from\")),\n+\t\tOPT_STRING(0, \"resolved-url\", &add_data.realrepo,\n+\t\t\t   N_(\"string\"),\n+\t\t\t   N_(\"url to clone the submodule from, after it has \"\n+\t\t\t      \"been dereferenced relative to parent's url, \"\n+\t\t\t      \"in the case where <url> is a relative url\")),\n+\t\tOPT_STRING(0, \"path\", &add_data.sm_path,\n+\t\t\t   N_(\"path\"),\n+\t\t\t   N_(\"where the new submodule will be cloned to\")),\n+\t\tOPT_STRING(0, \"name\", &add_data.sm_name,\n+\t\t\t   N_(\"string\"),\n+\t\t\t   N_(\"name of the new submodule\")),\n+\t\tOPT__FORCE(&force, N_(\"allow adding an otherwise ignored submodule path\"),\n+\t\t\t   PARSE_OPT_NOCOMPLETE),\n+\t\tOPT_END()\n+\t};\n+\n+\tconst char *const usage[] = {\n+\t\tN_(\"git submodule--helper add-config \"\n+\t\t   \"[--force|-f] [--branch|-b <branch>] \"\n+\t\t   \"--url <url> --resolved-url <resolved-url> \"\n+\t\t   \"--path <path> --name <name>\"),\n+\t\tNULL\n+\t};\n+\n+\targc = parse_options(argc, argv, prefix, options, usage, 0);\n+\n+\tif (argc)\n+\t\tusage_with_options(usage, options);\n+\n+\tadd_data.force = !!force;\n+\tconfigure_added_submodule(&add_data);\n+\n+\treturn 0;\n+}\n+\n #define SUPPORT_SUPER_PREFIX (1<<0)\n \n struct cmd_struct {\n@@ -2949,6 +3077,7 @@ static struct cmd_struct commands[] = {\n \t{\"name\", module_name, 0},\n \t{\"clone\", module_clone, 0},\n \t{\"add-clone\", add_clone, 0},\n+\t{\"add-config\", add_config, 0},\n \t{\"update-module-mode\", module_update_module_mode, 0},\n \t{\"update-clone\", update_clone, 0},\n \t{\"ensure-core-worktree\", ensure_core_worktree, 0},\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 053daf3724..f713cb113c 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -242,33 +242,7 @@ cmd_add()\n \tfi\n \n \tgit submodule--helper add-clone ${GIT_QUIET:+--quiet} ${force:+\"--force\"} ${progress:+\"--progress\"} ${branch:+--branch \"$branch\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"--dissociate\"} ${depth:+\"$depth\"} || exit\n-\tgit config submodule.\"$sm_name\".url \"$realrepo\"\n-\n-\tgit add --no-warn-embedded-repo $force \"$sm_path\" ||\n-\tdie \"fatal: $(eval_gettext \"Failed to add submodule '\\$sm_path'\")\"\n-\n-\tgit submodule--helper config submodule.\"$sm_name\".path \"$sm_path\" &&\n-\tgit submodule--helper config submodule.\"$sm_name\".url \"$repo\" &&\n-\tif test -n \"$branch\"\n-\tthen\n-\t\tgit submodule--helper config submodule.\"$sm_name\".branch \"$branch\"\n-\tfi &&\n-\tgit add --force .gitmodules ||\n-\tdie \"fatal: $(eval_gettext \"Failed to register submodule '\\$sm_path'\")\"\n-\n-\t# NEEDSWORK: In a multi-working-tree world, this needs to be\n-\t# set in the per-worktree config.\n-\tif git config --get submodule.active >/dev/null\n-\tthen\n-\t\t# If the submodule being adding isn't already covered by the\n-\t\t# current configured pathspec, set the submodule's active flag\n-\t\tif ! git submodule--helper is-active \"$sm_path\"\n-\t\tthen\n-\t\t\tgit config submodule.\"$sm_name\".active \"true\"\n-\t\tfi\n-\telse\n-\t\tgit config submodule.\"$sm_name\".active \"true\"\n-\tfi\n+\tgit submodule--helper add-config ${force:+--force} ${branch:+--branch \"$branch\"} --url \"$repo\" --resolved-url \"$realrepo\" --path \"$sm_path\" --name \"$sm_name\"\n }\n \n #\ndiff --git a/submodule.c b/submodule.c\nindex 0b1d9c1dde..8577667773 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -237,6 +237,11 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,\n /*\n  * Determine if a submodule has been initialized at a given 'path'\n  */\n+/*\n+ * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,\n+ * ie, the config looks like: \"[submodule] active\\n\".\n+ * Since that is an invalid pathspec, we should inform the user.\n+ */\n int is_submodule_active(struct repository *repo, const char *path)\n {\n \tint ret = 0;\n-- \n2.32.0\n\n"},{"id":"432228","messageId":"m2mtptu6is.fsf@gmail.com","threadId":"56227","inReplyTo":"20210806140431.92018-1-raykar.ath@gmail.com","subject":"Re: [GSoC] [PATCH v4] submodule--helper: introduce add-config subcommand","fromName":"Atharva Raykar","fromEmail":"raykar.ath@gmail.com","sentAt":"2021-08-07T06:13:15Z","receivedAt":"2021-08-07T06:13:25Z","isPatch":true,"sender":{"key":"raykar.ath@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24277692?v=4"},"body":"\nIt looks like I forgot send this as a reply to my v3, so I'll link that\nseries here instead:\n\nhttps://lore.kernel.org/git/20210801063352.50813-1-raykar.ath@gmail.com/\n\nAnd to fetch these changes:\ngit fetch https://github.com/tfidfwastaken/git.git submodule-helper-add-config-4\n\nAtharva Raykar <raykar.ath@gmail.com> writes:\n\n> Add a new \"add-config\" subcommand to `git submodule--helper` with the\n> goal of converting part of the shell code in git-submodule.sh related to\n> `git submodule add` into C code. This new subcommand sets the\n> configuration variables of a newly added submodule, by registering the\n> url in local git config, as well as the submodule name and path in the\n> .gitmodules file. It also sets 'submodule.<name>.active' to \"true\" if\n> the submodule path has not already been covered by any pathspec\n> specified in 'submodule.active'.\n>\n> This is meant to be a faithful conversion from shell to C, although we\n> add comments to areas that could be improved in future patches, after\n> the conversion has settled.\n>\n> Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>\n> Mentored-by: Christian Couder <christian.couder@gmail.com>\n> Mentored-by: Shourya Shukla <periperidip@gmail.com>\n> Based-on-patch-by: Shourya Shukla <periperidip@gmail.com>\n> Based-on-patch-by: Prathamesh Chavan <pc44800@gmail.com>\n> ---\n>\n> Changes since v3:\n> Address style nit.\n>\n> Range-diff against v3:\n> 1:  be520ad028 ! 1:  b3df2a5e6c submodule--helper: introduce add-config subcommand\n>     @@ builtin/submodule--helper.c: static int add_clone(int argc, const char **argv, c\n>      +\t    config_submodule_in_gitmodules(add_data->sm_name, \"url\", add_data->repo))\n>      +\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n>      +\n>     -+\tif (add_data->branch)\n>     ++\tif (add_data->branch) {\n>      +\t\tif (config_submodule_in_gitmodules(add_data->sm_name,\n>      +\t\t\t\t\t\t   \"branch\", add_data->branch))\n>      +\t\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n>     ++\t}\n>      +\n>      +\tadd_gitmodules.git_cmd = 1;\n>      +\tstrvec_pushl(&add_gitmodules.args,\n>\n>  builtin/submodule--helper.c | 129 ++++++++++++++++++++++++++++++++++++\n>  git-submodule.sh            |  28 +-------\n>  submodule.c                 |   5 ++\n>  3 files changed, 135 insertions(+), 27 deletions(-)\n>\n> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\n> index 862053c9f2..abf1ec2000 100644\n> --- a/builtin/submodule--helper.c\n> +++ b/builtin/submodule--helper.c\n> @@ -2936,6 +2936,134 @@ static int add_clone(int argc, const char **argv, const char *prefix)\n>  \treturn 0;\n>  }\n>\n> +static int config_submodule_in_gitmodules(const char *name, const char *var, const char *value)\n> +{\n> +\tchar *key;\n> +\tint ret;\n> +\n> +\tif (!is_writing_gitmodules_ok())\n> +\t\tdie(_(\"please make sure that the .gitmodules file is in the working tree\"));\n> +\n> +\tkey = xstrfmt(\"submodule.%s.%s\", name, var);\n> +\tret = config_set_in_gitmodules_file_gently(key, value);\n> +\tfree(key);\n> +\n> +\treturn ret;\n> +}\n> +\n> +static void configure_added_submodule(struct add_data *add_data)\n> +{\n> +\tchar *key;\n> +\tchar *val = NULL;\n> +\tstruct child_process add_submod = CHILD_PROCESS_INIT;\n> +\tstruct child_process add_gitmodules = CHILD_PROCESS_INIT;\n> +\n> +\tkey = xstrfmt(\"submodule.%s.url\", add_data->sm_name);\n> +\tgit_config_set_gently(key, add_data->realrepo);\n> +\tfree(key);\n> +\n> +\tadd_submod.git_cmd = 1;\n> +\tstrvec_pushl(&add_submod.args, \"add\",\n> +\t\t     \"--no-warn-embedded-repo\", NULL);\n> +\tif (add_data->force)\n> +\t\tstrvec_push(&add_submod.args, \"--force\");\n> +\tstrvec_pushl(&add_submod.args, \"--\", add_data->sm_path, NULL);\n> +\n> +\tif (run_command(&add_submod))\n> +\t\tdie(_(\"Failed to add submodule '%s'\"), add_data->sm_path);\n> +\n> +\tif (config_submodule_in_gitmodules(add_data->sm_name, \"path\", add_data->sm_path) ||\n> +\t    config_submodule_in_gitmodules(add_data->sm_name, \"url\", add_data->repo))\n> +\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n> +\n> +\tif (add_data->branch) {\n> +\t\tif (config_submodule_in_gitmodules(add_data->sm_name,\n> +\t\t\t\t\t\t   \"branch\", add_data->branch))\n> +\t\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n> +\t}\n> +\n> +\tadd_gitmodules.git_cmd = 1;\n> +\tstrvec_pushl(&add_gitmodules.args,\n> +\t\t     \"add\", \"--force\", \"--\", \".gitmodules\", NULL);\n> +\n> +\tif (run_command(&add_gitmodules))\n> +\t\tdie(_(\"Failed to register submodule '%s'\"), add_data->sm_path);\n> +\n> +\t/*\n> +\t * NEEDSWORK: In a multi-working-tree world this needs to be\n> +\t * set in the per-worktree config.\n> +\t */\n> +\t/*\n> +\t * NEEDSWORK: In the longer run, we need to get rid of this\n> +\t * pattern of querying \"submodule.active\" before calling\n> +\t * is_submodule_active(), since that function needs to find\n> +\t * out the value of \"submodule.active\" again anyway.\n> +\t */\n> +\tif (!git_config_get_string(\"submodule.active\", &val) && val) {\n> +\t\t/*\n> +\t\t * If the submodule being added isn't already covered by the\n> +\t\t * current configured pathspec, set the submodule's active flag\n> +\t\t */\n> +\t\tif (!is_submodule_active(the_repository, add_data->sm_path)) {\n> +\t\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n> +\t\t\tgit_config_set_gently(key, \"true\");\n> +\t\t\tfree(key);\n> +\t\t}\n> +\t} else {\n> +\t\tkey = xstrfmt(\"submodule.%s.active\", add_data->sm_name);\n> +\t\tgit_config_set_gently(key, \"true\");\n> +\t\tfree(key);\n> +\t}\n> +}\n> +\n> +static int add_config(int argc, const char **argv, const char *prefix)\n> +{\n> +\tint force = 0;\n> +\tstruct add_data add_data = ADD_DATA_INIT;\n> +\n> +\tstruct option options[] = {\n> +\t\tOPT_STRING('b', \"branch\", &add_data.branch,\n> +\t\t\t   N_(\"branch\"),\n> +\t\t\t   N_(\"branch of repository to store in \"\n> +\t\t\t      \"the submodule configuration\")),\n> +\t\tOPT_STRING(0, \"url\", &add_data.repo,\n> +\t\t\t   N_(\"string\"),\n> +\t\t\t   N_(\"url to clone submodule from\")),\n> +\t\tOPT_STRING(0, \"resolved-url\", &add_data.realrepo,\n> +\t\t\t   N_(\"string\"),\n> +\t\t\t   N_(\"url to clone the submodule from, after it has \"\n> +\t\t\t      \"been dereferenced relative to parent's url, \"\n> +\t\t\t      \"in the case where <url> is a relative url\")),\n> +\t\tOPT_STRING(0, \"path\", &add_data.sm_path,\n> +\t\t\t   N_(\"path\"),\n> +\t\t\t   N_(\"where the new submodule will be cloned to\")),\n> +\t\tOPT_STRING(0, \"name\", &add_data.sm_name,\n> +\t\t\t   N_(\"string\"),\n> +\t\t\t   N_(\"name of the new submodule\")),\n> +\t\tOPT__FORCE(&force, N_(\"allow adding an otherwise ignored submodule path\"),\n> +\t\t\t   PARSE_OPT_NOCOMPLETE),\n> +\t\tOPT_END()\n> +\t};\n> +\n> +\tconst char *const usage[] = {\n> +\t\tN_(\"git submodule--helper add-config \"\n> +\t\t   \"[--force|-f] [--branch|-b <branch>] \"\n> +\t\t   \"--url <url> --resolved-url <resolved-url> \"\n> +\t\t   \"--path <path> --name <name>\"),\n> +\t\tNULL\n> +\t};\n> +\n> +\targc = parse_options(argc, argv, prefix, options, usage, 0);\n> +\n> +\tif (argc)\n> +\t\tusage_with_options(usage, options);\n> +\n> +\tadd_data.force = !!force;\n> +\tconfigure_added_submodule(&add_data);\n> +\n> +\treturn 0;\n> +}\n> +\n>  #define SUPPORT_SUPER_PREFIX (1<<0)\n>\n>  struct cmd_struct {\n> @@ -2949,6 +3077,7 @@ static struct cmd_struct commands[] = {\n>  \t{\"name\", module_name, 0},\n>  \t{\"clone\", module_clone, 0},\n>  \t{\"add-clone\", add_clone, 0},\n> +\t{\"add-config\", add_config, 0},\n>  \t{\"update-module-mode\", module_update_module_mode, 0},\n>  \t{\"update-clone\", update_clone, 0},\n>  \t{\"ensure-core-worktree\", ensure_core_worktree, 0},\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 053daf3724..f713cb113c 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -242,33 +242,7 @@ cmd_add()\n>  \tfi\n>\n>  \tgit submodule--helper add-clone ${GIT_QUIET:+--quiet} ${force:+\"--force\"} ${progress:+\"--progress\"} ${branch:+--branch \"$branch\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"--dissociate\"} ${depth:+\"$depth\"} || exit\n> -\tgit config submodule.\"$sm_name\".url \"$realrepo\"\n> -\n> -\tgit add --no-warn-embedded-repo $force \"$sm_path\" ||\n> -\tdie \"fatal: $(eval_gettext \"Failed to add submodule '\\$sm_path'\")\"\n> -\n> -\tgit submodule--helper config submodule.\"$sm_name\".path \"$sm_path\" &&\n> -\tgit submodule--helper config submodule.\"$sm_name\".url \"$repo\" &&\n> -\tif test -n \"$branch\"\n> -\tthen\n> -\t\tgit submodule--helper config submodule.\"$sm_name\".branch \"$branch\"\n> -\tfi &&\n> -\tgit add --force .gitmodules ||\n> -\tdie \"fatal: $(eval_gettext \"Failed to register submodule '\\$sm_path'\")\"\n> -\n> -\t# NEEDSWORK: In a multi-working-tree world, this needs to be\n> -\t# set in the per-worktree config.\n> -\tif git config --get submodule.active >/dev/null\n> -\tthen\n> -\t\t# If the submodule being adding isn't already covered by the\n> -\t\t# current configured pathspec, set the submodule's active flag\n> -\t\tif ! git submodule--helper is-active \"$sm_path\"\n> -\t\tthen\n> -\t\t\tgit config submodule.\"$sm_name\".active \"true\"\n> -\t\tfi\n> -\telse\n> -\t\tgit config submodule.\"$sm_name\".active \"true\"\n> -\tfi\n> +\tgit submodule--helper add-config ${force:+--force} ${branch:+--branch \"$branch\"} --url \"$repo\" --resolved-url \"$realrepo\" --path \"$sm_path\" --name \"$sm_name\"\n>  }\n>\n>  #\n> diff --git a/submodule.c b/submodule.c\n> index 0b1d9c1dde..8577667773 100644\n> --- a/submodule.c\n> +++ b/submodule.c\n> @@ -237,6 +237,11 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,\n>  /*\n>   * Determine if a submodule has been initialized at a given 'path'\n>   */\n> +/*\n> + * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,\n> + * ie, the config looks like: \"[submodule] active\\n\".\n> + * Since that is an invalid pathspec, we should inform the user.\n> + */\n>  int is_submodule_active(struct repository *repo, const char *path)\n>  {\n>  \tint ret = 0;\n\n\n--\n---\nAtharva Raykar\nಅಥರ್ವ ರಾಯ್ಕರ್\nअथर्व रायकर\n"}]}