On 22-Jul-2021, at 16:51, Atharva Raykar <raykar.ath@xxxxxxxxx> wrote: > > 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, with only one > minor change: A warning is emitted if no value is specified in > 'submodule.active', ie, the config looks like: "[submodule] active\n", > because it is an invalid configuration. It would be helpful to let the > user know that the pathspec is unset, and the value of > 'submodule.<name>.active' might be set to 'true' so that they can > rectify their configuration and prevent future surprises (especially > given that the latter variable has a higher priority than the former). > > The structure of the conditional to check if we need to set the 'active' > toggle looks different from the shell version -- but behaves the same. > The change was made to decrease code duplication. A comment has been > added to explain that only one value of 'submodule.active' is obtained > to check if we need to call is_submodule_active() at all. > > Signed-off-by: Atharva Raykar <raykar.ath@xxxxxxxxx> > Mentored-by: Christian Couder <christian.couder@xxxxxxxxx> > Mentored-by: Shourya Shukla <periperidip@xxxxxxxxx> > Based-on-patch-by: Shourya Shukla <periperidip@xxxxxxxxx> > Based-on-patch-by: Prathamesh Chavan <pc44800@xxxxxxxxx> > --- > > This patch depends on changes introduced in 83913dd5b6 (t7400: test failure to > add submodule in tracked path, 2021-06-18), which belongs to the > ar/submodule-add (2021-07-12) series[1]. > > This changes in this patch are no different from the one in my first > submodule-add conversion series[2] which has already got some reviews before. > > [1] https://lore.kernel.org/git/20210710074801.19917-1-raykar.ath@xxxxxxxxx/ > [2] https://lore.kernel.org/git/20210615145745.33382-4-raykar.ath@xxxxxxxxx/ I forgot to mention, you can fetch this change through: git fetch https://github.com/tfidfwastaken/git.git submodule-helper-add-config-1