Update: Week 7
SUMMARY OF MY PROJECT:
Git submodule subcommands are currently implemented by using shell script 'git-submodule.sh'. There are several reasons why we'll prefer not to use the shell script. My project intends to convert the subcommands into C code, thus making them builtins. This will increase Git's portability and hence the efficiency of working with the git-submodule commands. Link to the complete proposal: [1]
Mentors:
Stefan Beller <[email protected]>
Christian Couder <[email protected]>
UPDATES:
Following are the updates about my ongoing project:
1. sync and status: The patches are updates after the last discussion, and will be posted with this update, along with the patches of the function get_submodule_displaypath() and for_each_submodule_list().
2. deinit: The patch was discussed in the last update, and I still have to make the required changes to this patch.
3. summary: I'm still working on debugging this patch as the are still some part where the patch isn't working as expected.
4. foreach: Most of the time was spent in reading the repo-object patch series. Also, currently I'm still confused about the approach I have to take for carrying this out.
PLAN FOR WEEK-8 (4 July 2017 to 10 July 2017):
The main focus for this week will be to get the reviewed code merged by sending new version after their review. Hence, I've attached the patches which were recently review, after adding the suggested changes, with this update. Other than that, there is still lots of work related to porting left as follows:
1. foreach: I'll try to come up with an approach for the present problem in the foreach patch, and get this discussed with mentors as well as with Brandon Williams so that I can get this subcommand ported.
2. summary: Currently, I'm still on debugging the patch. There are parts of the patch which aren't running as expected and hence it is taking more time to figure it out.
3. deinit: The patch was reviewed in the last update and I'm yet to work on the improving the patches as suggested.
Apart from this, there still lie two submodule subcommands: 'add' and 'update' unported.
I'll try to completed as much as work related to porting but will also, focus on improving the code completed so that it becomes good for merging.
[1]: https://docs.google.com/document/d/1krxVLooWl--75Pot3dazhfygR3wCUUWZWzTXtK1L-xU/
Thanks,
Prathamesh Chavan
PATCH v4 1/5 submodule--helper: introduce get_submodule_displaypath()
Introduce function get_submodule_displaypath() to replace the code occurring in submodule_init() for generating displaypath of the submodule with a call to it.
This new function will also be used in other parts of the system in later patches.
---
This series of patches are build over the 'mater' branch.
Complete build report is available at:
https://travis-ci.org/pratham-pc/git/builds
Branch: setnamerev
Build #119
builtin/submodule--helper.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
builtin/submodule--helper.c +22 -11
@@ -220,6 +220,27 @@ static int resolve_relative_url_test(int argc, const char **argv, const char *prreturn 0 ; } +static char *get_submodule_displaypath (const char *path,const char *prefix) +{ +const char *super_prefix =get_super_prefix (); + +if (prefix && super_prefix) { +BUG ("cannot have prefix '%s' and superprefix '%s'" , + prefix, super_prefix); + }else if (prefix) { +struct strbuf sb =STRBUF_INIT ; +char *displaypath =xstrdup (relative_path (path, prefix, &sb)); +strbuf_release (&sb); +return displaypath; + }else if (super_prefix) { +int len =strlen (super_prefix); +const char *format =is_dir_sep (super_prefix[len -1 ]) ?"%s%s" :"%s/%s" ; +return xstrfmt (format, super_prefix, path); + }else { +return xstrdup (path); + } +} +struct module_list {const struct cache_entry **entries;int alloc, nr;
@@ -339,16 +360,7 @@ static void init_submodule(const char *path, const char *prefix, int quiet)/* Only loads from .gitmodules, no overlay with .git/config */ gitmodules_config (); - -if (prefix &&get_super_prefix ()) -die ("BUG: cannot have prefix and superprefix" ); -else if (prefix) - displaypath =xstrdup (relative_path (path, prefix, &sb)); -else if (get_super_prefix ()) { -strbuf_addf (&sb,"%s%s" ,get_super_prefix (), path); - displaypath =strbuf_detach (&sb,NULL ); - }else - displaypath =xstrdup (path); + displaypath =get_submodule_displaypath (path, prefix); sub =submodule_from_path (null_sha1, path);
@@ -363,7 +375,6 @@ static void init_submodule(const char *path, const char *prefix, int quiet)* Set active flag for the submodule being initialized */ if (!is_submodule_initialized (path)) { -strbuf_reset (&sb);strbuf_addf (&sb,"submodule.%s.active" , sub->name);git_config_set_gently (sb.buf,"true" ); }
Signature · 1 line
2.13.0
PATCH v4 2/5 submodule--helper: introduce for_each_submodule_list()
Introduce function for_each_submodule_list() and replace a loop in module_init() with a call to it.
The new function will also be used in other parts of the system in later patches.
--- builtin/submodule--helper.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-)
builtin/submodule--helper.c +29 -10
@@ -14,6 +14,9 @@#include "refs.h" #include "connect.h" +typedef void (*submodule_list_func_t )(const struct cache_entry *list_item, +void *cb_data); +static char *get_default_remote (void ) {char *dest =NULL , *ret;
@@ -352,17 +355,30 @@ static int module_list(int argc, const char **argv, const char *prefix)return 0 ; } -static void init_submodule (const char *path,const char *prefix,int quiet) +static void for_each_submodule_list (const struct module_list list, +submodule_list_func_t fn,void *cb_data) { +int i; +for (i =0 ; i < list.nr; i++) +fn (list.entries[i], cb_data); +} + +struct init_cb { +const char *prefix; +unsigned int quiet:1 ; +}; +#define INIT_CB_INIT { NULL, 0 } + +static void init_submodule (const struct cache_entry *list_item,void *cb_data) +{ +struct init_cb *info = cb_data;const struct submodule *sub;struct strbuf sb =STRBUF_INIT ;char *upd =NULL , *url =NULL , *displaypath; -/* Only loads from .gitmodules, no overlay with .git/config */ -gitmodules_config (); - displaypath =get_submodule_displaypath (path, prefix); + displaypath =get_submodule_displaypath (list_item->name, info->prefix); - sub =submodule_from_path (null_sha1, path); + sub =submodule_from_path (null_sha1, list_item->name);if (!sub) die(_("No url found for submodule path '%s' in .gitmodules"),
@@ -374,7 +390,7 @@ static void init_submodule(const char *path, const char *prefix, int quiet)* * Set active flag for the submodule being initialized */ -if (!is_submodule_initialized (path)) { +if (!is_submodule_initialized (list_item->name)) {strbuf_addf (&sb,"submodule.%s.active" , sub->name);git_config_set_gently (sb.buf,"true" ); }
@@ -416,7 +432,7 @@ static void init_submodule(const char *path, const char *prefix, int quiet)if (git_config_set_gently (sb.buf, url))die (_ ("Failed to register url for submodule path '%s'" ), displaypath); -if (!quiet) +if (!info->quiet)fprintf (stderr,_ ("Submodule '%s' (%s) registered for path '%s'\n" ), sub->name, url, displaypath);
@@ -445,10 +461,10 @@ static void init_submodule(const char *path, const char *prefix, int quiet)static int module_init (int argc,const char **argv,const char *prefix) { +struct init_cb info =INIT_CB_INIT ;struct pathspec pathspec;struct module_list list =MODULE_LIST_INIT ;int quiet =0 ; -int i;struct option module_init_options[] = {OPT__QUIET (&quiet,N_ ("Suppress output for initializing a submodule" )),
@@ -473,8 +489,11 @@ static int module_init(int argc, const char **argv, const char *prefix)if (!argc &&git_config_get_value_multi ("submodule.active" ))module_list_active (&list); -for (i =0 ; i < list.nr; i++) -init_submodule (list.entries[i]->name, prefix, quiet); + info.prefix = prefix; + info.quiet = !!quiet; + +gitmodules_config (); +for_each_submodule_list (list, init_submodule, &info);return 0 ; }
Signature · 1 line
2.13.0
PATCH v4 3/5 submodule: port set_name_rev() from shell to C
In reply to Prathamesh ChavanFunction set_name_rev() is ported from git-submodule to the submodule--helper builtin. The function get_name_rev() generates the value of the revision name as required, and the function print_name_rev() handles the formating and printing of the obtained revision name.
---
As suggested the unnecessary enum present was removed.
builtin/submodule--helper.c | 63 +++++++++++++++++++++++++++++++++++++++++++++ git-submodule.sh | 16 ++---------- 2 files changed, 65 insertions(+), 14 deletions(-)
builtin/submodule--helper.c +63 -0
@@ -244,6 +244,68 @@ static char *get_submodule_displaypath(const char *path, const char *prefix) } } +static char *get_name_rev (const char *sub_path,const char * object_id) +{ +struct strbuf sb =STRBUF_INIT ; +const char ***d; + +static const char *describe_bare[] = { +NULL + }; + +static const char *describe_tags[] = { +"--tags" ,NULL + }; + +static const char *describe_contains[] = { +"--contains" ,NULL + }; + +static const char *describe_all_always[] = { +"--all" ,"--always" ,NULL + }; + +static const char **describe_argv[] = { + describe_bare, describe_tags, describe_contains, + describe_all_always,NULL + }; + +for (d = describe_argv; *d; d++) { +struct child_process cp =CHILD_PROCESS_INIT ; +prepare_submodule_repo_env (&cp.env_array); + cp.dir = sub_path; + cp.git_cmd =1 ; + cp.no_stderr =1 ; + +argv_array_push (&cp.args,"describe" ); +argv_array_pushv (&cp.args, *d); +argv_array_push (&cp.args, object_id); + +if (!capture_command (&cp, &sb,0 ) && sb.len) { +strbuf_strip_suffix (&sb,"\n" ); +return strbuf_detach (&sb,NULL ); + } + + } + +strbuf_release (&sb); +return NULL ; +} + +static int print_name_rev (int argc,const char **argv,const char *prefix) +{ +char *namerev; +if (argc !=3 ) +die ("print-name-rev only accepts two arguments: <path> <sha1>" ); + + namerev =get_name_rev (argv[1 ], argv[2 ]); +if (namerev && namerev[0 ]) +printf (" (%s)" , namerev); +printf ("\n" ); + +return 0 ; +} +struct module_list {const struct cache_entry **entries;int alloc, nr;
@@ -1242,6 +1304,7 @@ static struct cmd_struct commands[] = { {"relative-path", resolve_relative_path, 0}, {"resolve-relative-url", resolve_relative_url, 0}, {"resolve-relative-url-test", resolve_relative_url_test, 0}, + {"print-name-rev", print_name_rev, 0}, {"init", module_init, SUPPORT_SUPER_PREFIX}, {"remote-branch", resolve_remote_submodule_branch, 0}, {"push-check", push_check, 0},
git-submodule.sh +2 -14
@@ -759,18 +759,6 @@ cmd_update() } } -set_name_rev () { - revname=$( ( - sanitize_submodule_env - cd "$1" && { - git describe "$2" 2>/dev/null || - git describe --tags "$2" 2>/dev/null || - git describe --contains "$2" 2>/dev/null || - git describe --all --always "$2" - } - ) ) - test -z "$revname" || revname=" ($revname)" -} # # Show commit summary for submodules in index or working tree #
@@ -1042,14 +1030,14 @@ cmd_status() fi if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path" then - set_name_rev "$sm_path" "$sha1" + revname=$(git submodule--helper print-name-rev "$sm_path" "$sha1") say " $sha1 $displaypath$revname" else if test -z "$cached" then sha1=$(sanitize_submodule_env; cd "$sm_path" && git rev-parse --verify HEAD) fi - set_name_rev "$sm_path" "$sha1" + revname=$(git submodule--helper print-name-rev "$sm_path" "$sha1") say "+$sha1 $displaypath$revname" fi
Signature · 1 line
2.13.0
PATCH v4 4/5 submodule: port submodule subcommand 'status' from shell to C
In reply to Prathamesh ChavanThis 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.
---
A NEEDSWORK tag was added at the two places where optimization for future.
builtin/submodule--helper.c | 154 ++++++++++++++++++++++++++++++++++++++++++++ git-submodule.sh | 49 +------------- 2 files changed, 155 insertions(+), 48 deletions(-)
builtin/submodule--helper.c +154 -0
@@ -560,6 +560,159 @@ static int module_init(int argc, const char **argv, const char *prefix)return 0 ; } +struct status_cb { +const char *prefix; +unsigned int quiet:1 ; +unsigned int recursive:1 ; +unsigned int cached:1 ; +}; +#define STATUS_CB_INIT { NULL, 0, 0, 0 } + +static void print_status (struct status_cb *info,char state,const char *path, +char *sub_sha1,char *displaypath) +{ +if (info->quiet) +return ; + +printf ("%c%s %s" , state, sub_sha1, displaypath); + +if (state ==' ' || state =='+' ) { +struct argv_array name_rev_args =ARGV_ARRAY_INIT ; + +argv_array_pushl (&name_rev_args,"print-name-rev" , + path, sub_sha1,NULL ); +print_name_rev (name_rev_args.argc, name_rev_args.argv, + info->prefix); + }else { +printf ("\n" ); + } +} + +static void status_submodule (const struct cache_entry *list_item,void *cb_data) +{ +struct status_cb *info = cb_data; +char *sub_sha1 =xstrdup (oid_to_hex (&list_item->oid)); +char *displaypath; +struct argv_array diff_files_args =ARGV_ARRAY_INIT ; + +if (!submodule_from_path (null_sha1, list_item->name)) +die (_ ("no submodule mapping found in .gitmodules for path '%s'" ), + list_item->name); + + displaypath =get_submodule_displaypath (list_item->name, info->prefix); + +if (list_item->ce_flags) { +print_status (info,'U' , list_item->name, +sha1_to_hex (null_sha1), displaypath); + goto cleanup; + } + +if (!is_submodule_initialized (list_item->name)) { +print_status (info,'-' , list_item->name, sub_sha1, displaypath); + goto cleanup; + } + +argv_array_pushl (&diff_files_args,"diff-files" , +"--ignore-submodules=dirty" ,"--quiet" ,"--" , + list_item->name,NULL ); + +/* NEEDSWORK: future optimization possible */ +if (!cmd_diff_files (diff_files_args.argc, diff_files_args.argv, + info->prefix)) { +print_status (info,' ' , list_item->name, sub_sha1, displaypath); + }else { +if (!info->cached) { +struct child_process cp =CHILD_PROCESS_INIT ; +struct strbuf sb =STRBUF_INIT ; + +prepare_submodule_repo_env (&cp.env_array); + cp.git_cmd =1 ; + cp.dir = list_item->name; + +argv_array_pushl (&cp.args,"rev-parse" , +"--verify" ,"HEAD" ,NULL ); + +/* NEEDSWORK: future optimization possible */ +if (capture_command (&cp, &sb,0 )) +die (_ ("could not run 'git rev-parse --verify" +"HEAD' in submodule %s" ), + list_item->name); + +strbuf_strip_suffix (&sb,"\n" ); +print_status (info,'+' , list_item->name, sb.buf, + displaypath); +strbuf_release (&sb); + }else { +print_status (info,'+' , list_item->name, sub_sha1, + displaypath); + } + } + +if (info->recursive) { +struct child_process cpr =CHILD_PROCESS_INIT ; + + cpr.git_cmd =1 ; + cpr.dir = list_item->name; +prepare_submodule_repo_env (&cpr.env_array); + +argv_array_pushl (&cpr.args,"--super-prefix" , displaypath, +"submodule--helper" ,"status" ,"--recursive" , +NULL ); + +if (info->cached) +argv_array_push (&cpr.args,"--cached" ); + +if (info->quiet) +argv_array_push (&cpr.args,"--quiet" ); + +if (run_command (&cpr)) +die (_ ("failed to recurse into submodule '%s'" ), + list_item->name); + } + +cleanup: +free (displaypath); +free (sub_sha1); +} + +static int module_status (int argc,const char **argv,const char *prefix) +{ +struct status_cb info =STATUS_CB_INIT ; +struct pathspec pathspec; +struct module_list list =MODULE_LIST_INIT ; +int quiet =0 ; +int cached =0 ; +int recursive =0 ; + +struct option module_status_options[] = { +OPT__QUIET (&quiet,N_ ("Suppress submodule status output" )), +OPT_BOOL (0 ,"cached" , &cached,N_ ("Use commit stored in the index instead of the one stored in the submodule HEAD" )), +OPT_BOOL (0 ,"recursive" , &recursive,N_ ("Recurse into nested submodules" )), +OPT_END () + }; + +const char *const git_submodule_helper_usage[] = { +N_ ("git submodule status [--quiet] [--cached] [--recursive] [<path>]" ), +NULL + }; + + argc =parse_options (argc, argv, prefix, module_status_options, + git_submodule_helper_usage,0 ); + +if (module_list_compute (argc, argv, prefix, &pathspec, &list) <0 ) +return 1 ; + + info.prefix = prefix; + info.quiet = !!quiet; + info.recursive = !!recursive; + info.cached = !!cached; + +gitmodules_config (); +for_each_submodule_list (list, status_submodule, &info); + +return 0 ; +} +static int module_name (int argc,const char **argv,const char *prefix) {const struct submodule *sub;
@@ -1306,6 +1459,7 @@ static struct cmd_struct commands[] = { {"resolve-relative-url-test", resolve_relative_url_test, 0}, {"print-name-rev", print_name_rev, 0}, {"init", module_init, SUPPORT_SUPER_PREFIX}, + {"status", module_status, SUPPORT_SUPER_PREFIX}, {"remote-branch", resolve_remote_submodule_branch, 0}, {"push-check", push_check, 0}, {"absorb-git-dirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX},
git-submodule.sh +1 -48
55 lines not on this page · raw message
Signature · 1 line
2.13.0
PATCH v4 5/5 submodule: port submodule subcommand 'sync' from shell to C
In reply to Prathamesh ChavanPort the submodule subcommand 'sync' from shell to C using the same mechanism as that used for porting submodule subcommand 'status'. Hence, here the function cmd_sync() is ported from shell to C. This is done by introducing three functions: module_sync(), sync_submodule() and print_default_remote().
The function print_default_remote() is introduced for getting the default remote as stdout.
--- builtin/submodule--helper.c | 181 +++++++++++++++++++++++++++++++++++++++++++- git-submodule.sh | 56 +------------- 2 files changed, 181 insertions(+), 56 deletions(-)
builtin/submodule--helper.c +180 -1
@@ -44,6 +44,20 @@ static char *get_default_remote(void)return ret; } +static int print_default_remote (int argc,const char **argv,const char *prefix) +{ +const char *remote; + +if (argc !=1 ) +die (_ ("submodule--helper print-default-remote takes no arguments" )); + + remote =get_default_remote (); +if (remote) +puts (remote); + +return 0 ; +} +static int starts_with_dot_slash (const char *str) {return str[0 ] =='.' &&is_dir_sep (str[1 ]);
@@ -379,6 +393,25 @@ static void module_list_active(struct module_list *list) *list = active_modules; } +static char *get_up_path (const char *path) +{ +int i; +struct strbuf sb =STRBUF_INIT ; + +for (i =count_slashes (path); i; i--) +strbuf_addstr (&sb,"../" ); + +/* +* Check if 'path' ends with slash or not +* for having the same output for dir/sub_dir +* and dir/sub_dir/ +*/ +if (!is_dir_sep (path[strlen (path) -1 ])) +strbuf_addstr (&sb,"../" ); + +return strbuf_detach (&sb,NULL ); +} +static int module_list (int argc,const char **argv,const char *prefix) {int i;
@@ -478,16 +511,18 @@ static void init_submodule(const struct cache_entry *list_item, void *cb_data)char *remote =get_default_remote ();struct strbuf remotesb =STRBUF_INIT ;strbuf_addf (&remotesb,"remote.%s.url" , remote); -free (remote);if (git_config_get_string (remotesb.buf, &remoteurl)) {warning (_ ("could not lookup configuration '%s'. Assuming this repository is its own authoritative upstream." ), remotesb.buf); remoteurl =xgetcwd (); } relurl =relative_url (remoteurl, url,NULL ); + +free (remote);strbuf_release (&remotesb);free (remoteurl);free (url); + url = relurl; }
@@ -732,6 +767,148 @@ static int module_name(int argc, const char **argv, const char *prefix)return 0 ; } +struct sync_cb { +const char *prefix; +unsigned int quiet:1 ; +unsigned int recursive:1 ; +}; +#define SYNC_CB_INIT { NULL, 0, 0 } + +static void sync_submodule (const struct cache_entry *list_item,void *cb_data) +{ +struct sync_cb *info = cb_data; +const struct submodule *sub; +char *sub_key, *remote_key; +char *sub_origin_url, *super_config_url, *displaypath; +struct strbuf sb =STRBUF_INIT ; +struct child_process cp =CHILD_PROCESS_INIT ; + +if (!is_submodule_initialized (list_item->name)) +return ; + + sub =submodule_from_path (null_sha1, list_item->name); + +if (!sub || !sub->url) +die (_ ("no url found for submodule path '%s' in .gitmodules" ), + list_item->name); + +if (starts_with_dot_dot_slash (sub->url) ||starts_with_dot_slash (sub->url)) { +char *remote_url, *up_path; +char *remote =get_default_remote (); +char *remote_key =xstrfmt ("remote.%s.url" , remote); +free (remote); + +if (git_config_get_string (remote_key, &remote_url)) + remote_url =xgetcwd (); + up_path =get_up_path (list_item->name); + sub_origin_url =relative_url (remote_url, sub->url, up_path); + super_config_url =relative_url (remote_url, sub->url,NULL ); +free (remote_key); +free (up_path); +free (remote_url); + }else { + sub_origin_url =xstrdup (sub->url); + super_config_url =xstrdup (sub->url); + } + + displaypath =get_submodule_displaypath (list_item->name, info->prefix); + +if (!info->quiet) +printf (_ ("Synchronizing submodule url for '%s'\n" ), + displaypath); + + sub_key =xstrfmt ("submodule.%s.url" , sub->name); +if (git_config_set_gently (sub_key, super_config_url)) +die (_ ("failed to register url for submodule path '%s'" ), + displaypath); + +if (!is_submodule_populated_gently (list_item->name,NULL )) + goto cleanup; + +prepare_submodule_repo_env (&cp.env_array); + cp.git_cmd =1 ; + cp.dir = list_item->name; +argv_array_pushl (&cp.args,"submodule--helper" , +"print-default-remote" ,NULL ); +if (capture_command (&cp, &sb,0 )) +die (_ ("failed to get the default remote for submodule '%s'" ), + list_item->name); + +strbuf_strip_suffix (&sb,"\n" ); + remote_key =xstrfmt ("remote.%s.url" , sb.buf); +strbuf_release (&sb); + +child_process_init (&cp); +prepare_submodule_repo_env (&cp.env_array); + cp.git_cmd =1 ; + cp.dir = list_item->name; +argv_array_pushl (&cp.args,"config" , remote_key, sub_origin_url,NULL ); +if (run_command (&cp)) +die (_ ("failed to update remote for submodule '%s'" ), + list_item->name); + +if (info->recursive) { +struct child_process cpr =CHILD_PROCESS_INIT ; + + cpr.git_cmd =1 ; + cpr.dir = list_item->name; +prepare_submodule_repo_env (&cpr.env_array); + +argv_array_pushl (&cpr.args,"--super-prefix" , displaypath, +"submodule--helper" ,"sync" ,"--recursive" , +NULL ); + +if (info->quiet) +argv_array_push (&cpr.args,"--quiet" ); + +if (run_command (&cpr)) +die (_ ("failed to recurse into submodule '%s'" ), + list_item->name); + } + +cleanup: +free (sub_key); +free (super_config_url); +free (displaypath); +free (sub_origin_url); +} + +static int module_sync (int argc,const char **argv,const char *prefix) +{ +struct sync_cb info =SYNC_CB_INIT ; +struct pathspec pathspec; +struct module_list list =MODULE_LIST_INIT ; +int quiet =0 ; +int recursive =0 ; + +struct option module_sync_options[] = { +OPT__QUIET (&quiet,N_ ("Suppress output of synchronizing submodule url" )), +OPT_BOOL (0 ,"recursive" , &recursive, +N_ ("Recurse into nested submodules" )), +OPT_END () + }; + +const char *const git_submodule_helper_usage[] = { +N_ ("git submodule--helper sync [--quiet] [--recursive] [<path>]" ), +NULL + }; + + argc =parse_options (argc, argv, prefix, module_sync_options, + git_submodule_helper_usage,0 ); + +if (module_list_compute (argc, argv, prefix, &pathspec, &list) <0 ) +return 1 ; + + info.prefix = prefix; + info.quiet = !!quiet; + info.recursive = !!recursive; + +gitmodules_config (); +for_each_submodule_list (list, sync_submodule, &info); + +return 0 ; +} +static int clone_submodule (const char *path,const char *gitdir,const char *url,const char *depth,struct string_list *reference,int quiet,int progress)
@@ -1460,6 +1637,8 @@ static struct cmd_struct commands[] = { {"print-name-rev", print_name_rev, 0}, {"init", module_init, SUPPORT_SUPER_PREFIX}, {"status", module_status, SUPPORT_SUPER_PREFIX}, + {"print-default-remote", print_default_remote, 0}, + {"sync", module_sync, SUPPORT_SUPER_PREFIX}, {"remote-branch", resolve_remote_submodule_branch, 0}, {"push-check", push_check, 0}, {"absorb-git-dirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX},
git-submodule.sh +1 -55
64 lines not on this page · raw message
Signature · 1 line
2.13.0