aboutsummaryrefslogtreecommitdiffstats
path: root/submodule.c
diff options
context:
space:
mode:
authorAtharva Raykar <raykar.ath@gmail.com>2021-08-06 19:34:31 +0530
committerJunio C Hamano <gitster@pobox.com>2021-08-10 10:57:57 -0700
commita452128a36cb73f5366c23eabe93c7edfa227866 (patch)
treeffad56bf1145c48e1bd64c73a2d642df972745ad /submodule.c
parentbbe3165f825c8d9b6e4a6747a287147b4583c3c1 (diff)
downloadgit-a452128a36cb73f5366c23eabe93c7edfa227866.tar.gz
submodule--helper: introduce add-config subcommand
Add a new "add-config" subcommand to `git submodule--helper` with the goal of converting part of the shell code in git-submodule.sh related to `git submodule add` into C code. This new subcommand sets the configuration variables of a newly added submodule, by registering the url in local git config, as well as the submodule name and path in the .gitmodules file. It also sets 'submodule.<name>.active' to "true" if the submodule path has not already been covered by any pathspec specified in 'submodule.active'. This is meant to be a faithful conversion from shell to C, although we add comments to areas that could be improved in future patches, after the conversion has settled. Signed-off-by: Atharva Raykar <raykar.ath@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Shourya Shukla <periperidip@gmail.com> Based-on-patch-by: Shourya Shukla <periperidip@gmail.com> Based-on-patch-by: Prathamesh Chavan <pc44800@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 0b1d9c1dde..8577667773 100644
--- a/submodule.c
+++ b/submodule.c
@@ -237,6 +237,11 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
/*
* Determine if a submodule has been initialized at a given 'path'
*/
+/*
+ * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,
+ * ie, the config looks like: "[submodule] active\n".
+ * Since that is an invalid pathspec, we should inform the user.
+ */
int is_submodule_active(struct repository *repo, const char *path)
{
int ret = 0;