]> git.ipfire.org Git - thirdparty/git.git/commit - git-submodule.sh
submodule: move core cmd_update() logic to C
authorAtharva Raykar <raykar.ath@gmail.com>
Tue, 15 Mar 2022 21:09:24 +0000 (14:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Mar 2022 22:07:43 +0000 (15:07 -0700)
commitb3c5f5cb04854b56b39a40696c366053c8f09b58
tree89bcc2ba51e302d9b53447f34cc8d878a994338a
parent75df9df0f81368816612cdb11a6c4bb054724ea3
submodule: move core cmd_update() logic to C

This patch completes the conversion past the flag parsing of
`submodule update` by introducing a helper subcommand called
`submodule--helper update`. The behaviour of `submodule update` should
remain the same after this patch.

Prior to this patch, `submodule update` was implemented by piping the
output of `update-clone` (which clones all missing submodules, then
prints relevant information for all submodules) into
`run-update-procedure` (which reads the information and updates the
submodule tree).

With `submodule--helper update`, we iterate over the submodules and
update the submodule tree in the same process. This reuses most of
existing code structure, except that `update_submodule()` now updates
the submodule tree (instead of printing submodule information to be
consumed by another process).

Recursing on a submodule is done by calling a subprocess that launches
`submodule--helper update`, with a modified `--recursive-prefix` and
`--prefix` parameter.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <periperidip@gmail.com>
Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
git-submodule.sh