]> git.ipfire.org Git - thirdparty/git.git/commit - git-submodule.sh
submodule: port submodule subcommand 'status' from shell to C
authorPrathamesh Chavan <pc44800@gmail.com>
Fri, 6 Oct 2017 13:24:15 +0000 (18:54 +0530)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 08:52:35 +0000 (17:52 +0900)
commita9f8a37584a6d3e4702ce115476bebda20d871d3
tree33fdfd4c744412dfe2179e358ff4d8d0d3bb0a2e
parent9f580a6260ab301916286fb6ca05f6613e9904e8
submodule: port submodule subcommand 'status' from shell to C

This aims to make git-submodule 'status' a built-in. Hence, the function
cmd_status() is ported from shell to C. This is done by introducing
four functions: module_status(), submodule_status_cb(),
submodule_status() and print_status().

The function module_status() acts as the front-end of the subcommand.
It parses subcommand's options and then calls the function
module_list_compute() for computing the list of submodules. Then
this functions calls for_each_listed_submodule() looping through the
list obtained.

Then for_each_listed_submodule() calls submodule_status_cb() for each of
the submodule in its list. The function submodule_status_cb() calls
submodule_status() after passing appropriate arguments to the funciton.
Function submodule_status() is responsible for generating the status
each submodule it is called for, and then calls print_status().

Finally, the function print_status() handles the printing of submodule's
status.

Function set_name_rev() is also ported from git-submodule to the
submodule--helper builtin function compute_rev_name(), which now
generates the value of the revision name as required.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
git-submodule.sh