@@ -3885,6 +3885,7 @@ struct update_callback_data {
38853885 struct index_state * index ;
38863886 int include_sparse ;
38873887 int flags ;
3888+ int ignored_too ;
38883889 int add_errors ;
38893890};
38903891
@@ -3930,9 +3931,25 @@ static void update_callback(struct diff_queue_struct *q,
39303931 const struct submodule * sub = submodule_from_path (data -> repo , NULL , path );
39313932 if (sub ) {
39323933 if ( sub -> ignore ) {
3933- fprintf ( stderr , "GIT_TRACE: Skipping submodule with ignore NOT NULL: %s\n" , path );
3934+ trace_printf ( " ignore= %s\n" , sub -> ignore );
39343935 if (strcmp (sub -> ignore , "all" ) == 0 ) {
3936+ trace_printf ("ignore=all - test\n" );
3937+ if ( data -> ignored_too ) {
3938+ trace_printf ("ignored_too=%d --force given\n" , data -> ignored_too );
3939+ if ( data -> ignored_too > 0 ) {
3940+ trace_printf ("Adding submodule even ignore=all is due to --force|-f: %s\n" , path );
3941+ } else {
3942+ printf ("Skipping submodule with ignore=all: %s\n" , path );
3943+ printf (" Use -f if you really want to add them." );
3944+ continue ;
3945+ }
3946+ } else {
3947+ trace_printf ("--force not set" );
3948+ continue ;
3949+ }
3950+ } else {
39353951 trace_printf ("Skipping submodule with ignore=all: %s\n" , path );
3952+ trace_printf (" Use -f if you really want to add them." );
39363953 continue ;
39373954 }
39383955 }
@@ -3957,7 +3974,7 @@ static void update_callback(struct diff_queue_struct *q,
39573974
39583975int add_files_to_cache (struct repository * repo , const char * prefix ,
39593976 const struct pathspec * pathspec , char * ps_matched ,
3960- int include_sparse , int flags )
3977+ int include_sparse , int flags , int ignored_too )
39613978{
39623979 struct update_callback_data data ;
39633980 struct rev_info rev ;
@@ -3966,6 +3983,8 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
39663983 data .index = repo -> index ;
39673984 data .include_sparse = include_sparse ;
39683985 data .flags = flags ;
3986+ trace_printf ("DEBUG ignored_too=%d\n" , ignored_too );
3987+ data .ignored_too = ignored_too ;
39693988
39703989 repo_init_revisions (repo , & rev , prefix );
39713990 setup_revisions (0 , NULL , & rev , NULL );
0 commit comments