• Prathamesh Chavan's avatar
    submodule: port submodule subcommand 'status' from shell to C · a9f8a375
    Prathamesh Chavan authored
    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's avatarChristian Couder <christian.couder@gmail.com>
    Mentored-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
    Signed-off-by: Prathamesh Chavan's avatarPrathamesh Chavan <pc44800@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    a9f8a375
git-submodule.sh 26.2 KB