Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit baa2e93

Browse files
committed
Merge branch 'jc/rm-submodule-error-message'
Consolidate two messages phrased subtly differently without a good reason. * jc/rm-submodule-error-message: builtin/rm.c: consolidate error reporting for removing submodules
2 parents a5203a3 + 658ff47 commit baa2e93

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

builtin/rm.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ static void print_error_files(struct string_list *files_list,
5858
}
5959
}
6060

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+
6176
static int check_submodules_use_gitfiles(void)
6277
{
6378
int i;
@@ -86,16 +101,8 @@ static int check_submodules_use_gitfiles(void)
86101
if (!submodule_uses_gitfile(name))
87102
string_list_append(&files, name);
88103
}
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);
99106

100107
return errs;
101108
}
@@ -237,17 +244,9 @@ static int check_local_mod(unsigned char *head, int index_only)
237244
" or -f to force removal)"),
238245
&errs);
239246
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+
251250
print_error_files(&files_local,
252251
Q_("the following file has local modifications:",
253252
"the following files have local modifications:",

0 commit comments

Comments
 (0)