Re: [GSoC][PATCH 4/5 v4] submodule: port submodule subcommand 'status' from shell to C
From: Stefan Beller <hidden>
Date: 2017-07-13 22:44:15
On Thu, Jul 13, 2017 at 1:05 PM, Prathamesh Chavan [off-list ref] wrote:
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 three functions: module_status(), 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_submodule_list() looping through the list obtained. Then for_each_submodule_list() calls submodule_status() for each of the submodule in its list. The 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. Mentored-by: Christian Couder [off-list ref] Mentored-by: Stefan Beller [off-list ref] Signed-off-by: Prathamesh Chavan <redacted> --- In this new version of patch: Instead of using cmd_diff_files(), the process is optimized by using ce_match_stat().
Apart from this I have reviewed the patch and found it a faithful conversion. I am not an expert in the diff area and wonder how the cmd_diff_files functionality is achieved with just a stat call and then comparing it to ce_match_stat. 'Using "dirty" ignores all changes to the work tree of submodules, only changes to the commits stored in the superproject are shown.' So I'd have expected ce->oid to be compared (is there an index entry differing, i.e. more than one stage?)
Also, the child_process running the command 'rev-parse --verify HEAD' is removed for optimization reasons, and instead head_ref_submodule() is used with callback function handle_submodule_head_ref().
Cool.