diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-08-01 11:57:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-01 11:57:25 -0700 |
commit | baa2e936990a9bce84fdb8bcffbd940f05800241 (patch) | |
tree | a2b6a983c208ce4a30df8db1276928e7670edeac /builtin | |
parent | a5203a3f044ced7904800f3f233451474c1d5120 (diff) | |
parent | 658ff473cf35217253aa956508ff0e42993711ad (diff) | |
download | git-baa2e936990a9bce84fdb8bcffbd940f05800241.tar.gz |
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
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/rm.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/builtin/rm.c b/builtin/rm.c index 18916e022a..0df0b4d942 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -58,6 +58,21 @@ static void print_error_files(struct string_list *files_list, } } +static void error_removing_concrete_submodules(struct string_list *files, int *errs) +{ + print_error_files(files, + Q_("the following submodule (or one of its nested " + "submodules)\n" + "uses a .git directory:", + "the following submodules (or one of its nested " + "submodules)\n" + "use a .git directory:", files->nr), + _("\n(use 'rm -rf' if you really want to remove " + "it including all of its history)"), + errs); + string_list_clear(files, 0); +} + static int check_submodules_use_gitfiles(void) { int i; @@ -86,16 +101,8 @@ static int check_submodules_use_gitfiles(void) if (!submodule_uses_gitfile(name)) string_list_append(&files, name); } - print_error_files(&files, - Q_("the following submodule (or one of its nested " - "submodules)\n uses a .git directory:", - "the following submodules (or one of its nested " - "submodules)\n use a .git directory:", - files.nr), - _("\n(use 'rm -rf' if you really want to remove " - "it including all of its history)"), - &errs); - string_list_clear(&files, 0); + + error_removing_concrete_submodules(&files, &errs); return errs; } @@ -237,17 +244,9 @@ static int check_local_mod(unsigned char *head, int index_only) " or -f to force removal)"), &errs); string_list_clear(&files_cached, 0); - print_error_files(&files_submodule, - Q_("the following submodule (or one of its nested " - "submodule)\nuses a .git directory:", - "the following submodules (or one of its nested " - "submodule)\nuse a .git directory:", - files_submodule.nr), - _("\n(use 'rm -rf' if you really " - "want to remove it including all " - "of its history)"), - &errs); - string_list_clear(&files_submodule, 0); + + error_removing_concrete_submodules(&files_submodule, &errs); + print_error_files(&files_local, Q_("the following file has local modifications:", "the following files have local modifications:", |