NOTE: This series uses the change introduced by 'ar/submodule-add-config'[1] This series completes the conversion of all the important shell logic in 'submodule add' to C, by wrapping it in a submodule--helper builtin subcommand called 'add'. The first 4 patches are preparatory patches. The refactors mostly involve exposing interfaces to C that were only previously usable as shell subcommands. Then we have a patch that translates the shell code to C, faithfully reproducing the behaviour before the conversion. The last 3 patches are cleanup patches. Our conversions have introduced a lot of dead code, all of them being 'submodule--helper' subcommands that have no further use, as we have C interfaces for these already. We remove these subcommands. A question about the cache API used in [PATCH 5/8]: What is the difference between 'read_cache()' and 'read_cache_preload()'? [2] Which one is more appropriate for use in 'die_on_index_match()'? Fetch-it-Via: git fetch https://github.com/tfidfwastaken/git submodule-helper-add-list-1 Footnotes ========= [1] https://lore.kernel.org/git/20210801063352.50813-1-raykar.ath@xxxxxxxxx/ [2] More about this question has been detailed in this section of my blog: http://atharvaraykar.me/gitnotes/week5#some-challenges-with-the-changes-that-are-cooking I'll quote it here for convenience: > Before iterating through the cache entries of the index, you need to populate > it. > > There’s two functions for this: read_cache() and read_cache_preload(). I have > used the latter in my code. The thing is, when I swap it with the former, I > could not find any change in the behaviour of my code. They appear to function > equivalently. > > I understand that the *_preload() variant takes a pathspec which preloads index > contents that match the pathspec in parallel. I don’t know what passing NULL to > it does. Moreover, does this imply that read_cache() loads the cache on-demand, > ie, it does no preloading? > > I am not sure about what exactly are their differences, and when is one variant > preferred over the other. Atharva Raykar (8): submodule--helper: refactor resolve_relative_url() helper submodule--helper: remove repeated code in sync_submodule() dir: libify and export helper functions from clone.c submodule--helper: remove constness of sm_path submodule--helper: convert the bulk of cmd_add() to C submodule--helper: remove add-clone subcommand submodule--helper: remove add-config subcommand submodule--helper: remove resolve-relative-url subcommand builtin/clone.c | 118 +------------- builtin/submodule--helper.c | 304 +++++++++++++++++++----------------- dir.c | 114 ++++++++++++++ dir.h | 3 + git-submodule.sh | 96 +----------- 5 files changed, 278 insertions(+), 357 deletions(-) -- 2.32.0