@@ -58,6 +58,21 @@ static void print_error_files(struct string_list *files_list,
58
58
}
59
59
}
60
60
61
+ static void error_removing_concrete_submodules (struct string_list * files , int * errs )
62
+ {
63
+ print_error_files (files ,
64
+ Q_ ("the following submodule (or one of its nested "
65
+ "submodules)\n"
66
+ "uses a .git directory:" ,
67
+ "the following submodules (or one of its nested "
68
+ "submodules)\n"
69
+ "use a .git directory:" , files -> nr ),
70
+ _ ("\n(use 'rm -rf' if you really want to remove "
71
+ "it including all of its history)" ),
72
+ errs );
73
+ string_list_clear (files , 0 );
74
+ }
75
+
61
76
static int check_submodules_use_gitfiles (void )
62
77
{
63
78
int i ;
@@ -86,16 +101,8 @@ static int check_submodules_use_gitfiles(void)
86
101
if (!submodule_uses_gitfile (name ))
87
102
string_list_append (& files , name );
88
103
}
89
- print_error_files (& files ,
90
- Q_ ("the following submodule (or one of its nested "
91
- "submodules)\n uses a .git directory:" ,
92
- "the following submodules (or one of its nested "
93
- "submodules)\n use a .git directory:" ,
94
- files .nr ),
95
- _ ("\n(use 'rm -rf' if you really want to remove "
96
- "it including all of its history)" ),
97
- & errs );
98
- string_list_clear (& files , 0 );
104
+
105
+ error_removing_concrete_submodules (& files , & errs );
99
106
100
107
return errs ;
101
108
}
@@ -237,17 +244,9 @@ static int check_local_mod(unsigned char *head, int index_only)
237
244
" or -f to force removal)" ),
238
245
& errs );
239
246
string_list_clear (& files_cached , 0 );
240
- print_error_files (& files_submodule ,
241
- Q_ ("the following submodule (or one of its nested "
242
- "submodule)\nuses a .git directory:" ,
243
- "the following submodules (or one of its nested "
244
- "submodule)\nuse a .git directory:" ,
245
- files_submodule .nr ),
246
- _ ("\n(use 'rm -rf' if you really "
247
- "want to remove it including all "
248
- "of its history)" ),
249
- & errs );
250
- string_list_clear (& files_submodule , 0 );
247
+
248
+ error_removing_concrete_submodules (& files_submodule , & errs );
249
+
251
250
print_error_files (& files_local ,
252
251
Q_ ("the following file has local modifications:" ,
253
252
"the following files have local modifications:" ,
0 commit comments