@@ -780,6 +780,10 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
780
780
struct strbuf * out )
781
781
{
782
782
const struct submodule * sub = NULL ;
783
+ const char * url = NULL ;
784
+ const char * update_string ;
785
+ enum submodule_update_type update_type ;
786
+ char * key ;
783
787
struct strbuf displaypath_sb = STRBUF_INIT ;
784
788
struct strbuf sb = STRBUF_INIT ;
785
789
const char * displaypath = NULL ;
@@ -808,9 +812,17 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
808
812
goto cleanup ;
809
813
}
810
814
815
+ key = xstrfmt ("submodule.%s.update" , sub -> name );
816
+ if (!repo_config_get_string_const (the_repository , key , & update_string )) {
817
+ update_type = parse_submodule_update_type (update_string );
818
+ } else {
819
+ update_type = sub -> update_strategy .type ;
820
+ }
821
+ free (key );
822
+
811
823
if (suc -> update .type == SM_UPDATE_NONE
812
824
|| (suc -> update .type == SM_UPDATE_UNSPECIFIED
813
- && sub -> update_strategy . type == SM_UPDATE_NONE )) {
825
+ && update_type == SM_UPDATE_NONE )) {
814
826
strbuf_addf (out , _ ("Skipping submodule '%s'" ), displaypath );
815
827
strbuf_addch (out , '\n' );
816
828
goto cleanup ;
@@ -822,6 +834,11 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
822
834
goto cleanup ;
823
835
}
824
836
837
+ strbuf_reset (& sb );
838
+ strbuf_addf (& sb , "submodule.%s.url" , sub -> name );
839
+ if (repo_config_get_string_const (the_repository , sb .buf , & url ))
840
+ url = sub -> url ;
841
+
825
842
strbuf_reset (& sb );
826
843
strbuf_addf (& sb , "%s/.git" , ce -> name );
827
844
needs_cloning = !file_exists (sb .buf );
@@ -851,7 +868,7 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
851
868
argv_array_push (& child -> args , "--depth=1" );
852
869
argv_array_pushl (& child -> args , "--path" , sub -> path , NULL );
853
870
argv_array_pushl (& child -> args , "--name" , sub -> name , NULL );
854
- argv_array_pushl (& child -> args , "--url" , sub -> url , NULL );
871
+ argv_array_pushl (& child -> args , "--url" , url , NULL );
855
872
if (suc -> references .nr ) {
856
873
struct string_list_item * item ;
857
874
for_each_string_list_item (item , & suc -> references )
@@ -1025,9 +1042,7 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1025
1042
if (pathspec .nr )
1026
1043
suc .warn_if_uninitialized = 1 ;
1027
1044
1028
- /* Overlay the parsed .gitmodules file with .git/config */
1029
1045
gitmodules_config ();
1030
- git_config (submodule_config , NULL );
1031
1046
1032
1047
run_processes_parallel (max_jobs ,
1033
1048
update_clone_get_next_task ,
0 commit comments