{"thread":{"id":"34538","subject":"redundant message in builtin/rm.c","startedAt":"2013-07-26T02:37:56Z","lastAt":"2013-08-05T10:10:37Z","messageCount":4,"participants":["Jiang Xin","Ralf Thielow","Junio C Hamano","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"224101","messageId":"CANYiYbGQj6mCDraxiBHXEL+qd7OwnFCaMpB3Wb4_Pg=-p+KJAg@mail.gmail.com","threadId":"34538","inReplyTo":null,"subject":"redundant message in builtin/rm.c","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-07-26T02:37:56Z","receivedAt":"2013-07-26T02:37:56Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Hi,\n\nCommit v1.8.3-1-g914dc02 (rm: better error message on failure for\nmultiple files)\nintroduced many messages need to be translated. I found two similar messages\neach has a slight typo, and the differences cause redundant works for\nl10n translators.\n\n        # builtin/rm.c, line: 90\n\n                          Q_(\"the following submodule (or one of its nested \"\n                             \"submodules)\\n uses a .git directory:\",\n                             \"the following submodules (or one of its nested \"\n                             \"submodules)\\n use a .git directory:\",\n\n                         ( no space before \"use(s) a .git directory\" ?)\n\n        # builtin/rm.c, line: 240\n\n                          Q_(\"the following submodule (or one of its nested \"\n                             \"submodule)\\nuses a .git directory:\",\n                             \"the following submodules (or one of its nested \"\n                             \"submodule)\\nuse a .git directory:\",\n\n                         ( \"nested submodule\" should be \"nested submodules\" ?)\n\n-- \nJiang Xin\n"},{"id":"224103","messageId":"CAN0XMOJ+ar+iKwVi_z02x7p3XcZj0SxT69a7ApRxOioet8RwDw@mail.gmail.com","threadId":"34538","inReplyTo":"CANYiYbGQj6mCDraxiBHXEL+qd7OwnFCaMpB3Wb4_Pg=-p+KJAg@mail.gmail.com","subject":"Re: redundant message in builtin/rm.c","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2013-07-26T04:03:54Z","receivedAt":"2013-07-26T04:03:54Z","isPatch":false,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"2013/7/26 Jiang Xin <worldhello.net@gmail.com>:\n> Hi,\n>\n> Commit v1.8.3-1-g914dc02 (rm: better error message on failure for\n> multiple files)\n> introduced many messages need to be translated. I found two similar messages\n> each has a slight typo, and the differences cause redundant works for\n> l10n translators.\n>\n>         # builtin/rm.c, line: 90\n>\n>                           Q_(\"the following submodule (or one of its nested \"\n>                              \"submodules)\\n uses a .git directory:\",\n>                              \"the following submodules (or one of its nested \"\n>                              \"submodules)\\n use a .git directory:\",\n>\n>                          ( no space before \"use(s) a .git directory\" ?)\n>\n>         # builtin/rm.c, line: 240\n>\n>                           Q_(\"the following submodule (or one of its nested \"\n>                              \"submodule)\\nuses a .git directory:\",\n>                              \"the following submodules (or one of its nested \"\n>                              \"submodule)\\nuse a .git directory:\",\n>\n>                          ( \"nested submodule\" should be \"nested submodules\" ?)\n>\n\nIt's more readable if \"\\n\" is at the end of a line.\n\nQ_(\"the following submodule (or one of its nested submodules)\\n\"\n\"uses a .git directory:\"\n\n> --\n> Jiang Xin\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"224107","messageId":"7v1u6l501r.fsf@alter.siamese.dyndns.org","threadId":"34538","inReplyTo":"CAN0XMOJ+ar+iKwVi_z02x7p3XcZj0SxT69a7ApRxOioet8RwDw@mail.gmail.com","subject":"Re: redundant message in builtin/rm.c","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-26T06:04:48Z","receivedAt":"2013-07-26T06:04:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ralf Thielow <ralf.thielow@gmail.com> writes:\n\n> It's more readable if \"\\n\" is at the end of a line.\n>\n> Q_(\"the following submodule (or one of its nested submodules)\\n\"\n> \"uses a .git directory:\"\n\nThanks both.  Perhaps we should do something like this?\n\n-- >8 --\nSubject: builtin/rm.c: consolidate error reporting for removing submodules\n\nWe have two (not identical) copies of error reporting when\nattempting to remove submodules that have their repositories\nembedded within them.  Add a helper function so that we do not have\nto repeat similar error messages with subtly different wording\nwithout a good reason.\n\nNoticed by Jiang Xin.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/rm.c | 41 ++++++++++++++++++++---------------------\n 1 file changed, 20 insertions(+), 21 deletions(-)\n\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 5d0c068..694568a 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -57,6 +57,21 @@ static void print_error_files(struct string_list *files_list,\n \t}\n }\n \n+static void error_removing_concrete_submodules(struct string_list *files, int *errs)\n+{\n+\tprint_error_files(files,\n+\t\t\t  Q_(\"the following submodule (or one of its nested \"\n+\t\t\t     \"submodules)\\n\"\n+\t\t\t     \"uses a .git directory:\",\n+\t\t\t     \"the following submodules (or one of its nested \"\n+\t\t\t     \"submodules)\\n\"\n+\t\t\t     \"use a .git directory:\", files->nr),\n+\t\t\t  _(\"\\n(use 'rm -rf' if you really want to remove \"\n+\t\t\t    \"it including all of its history)\"),\n+\t\t\t  errs);\n+\tstring_list_clear(files, 0);\n+}\n+\n static int check_submodules_use_gitfiles(void)\n {\n \tint i;\n@@ -85,16 +100,8 @@ static int check_submodules_use_gitfiles(void)\n \t\tif (!submodule_uses_gitfile(name))\n \t\t\tstring_list_append(&files, name);\n \t}\n-\tprint_error_files(&files,\n-\t\t\t  Q_(\"the following submodule (or one of its nested \"\n-\t\t\t     \"submodules)\\n uses a .git directory:\",\n-\t\t\t     \"the following submodules (or one of its nested \"\n-\t\t\t     \"submodules)\\n use a .git directory:\",\n-\t\t\t     files.nr),\n-\t\t\t  _(\"\\n(use 'rm -rf' if you really want to remove \"\n-\t\t\t    \"it including all of its history)\"),\n-\t\t\t  &errs);\n-\tstring_list_clear(&files, 0);\n+\n+\terror_removing_concrete_submodules(&files, &errs);\n \n \treturn errs;\n }\n@@ -236,17 +243,9 @@ static int check_local_mod(unsigned char *head, int index_only)\n \t\t\t    \" or -f to force removal)\"),\n \t\t\t  &errs);\n \tstring_list_clear(&files_cached, 0);\n-\tprint_error_files(&files_submodule,\n-\t\t\t  Q_(\"the following submodule (or one of its nested \"\n-\t\t\t     \"submodule)\\nuses a .git directory:\",\n-\t\t\t     \"the following submodules (or one of its nested \"\n-\t\t\t     \"submodule)\\nuse a .git directory:\",\n-\t\t\t     files_submodule.nr),\n-\t\t\t  _(\"\\n(use 'rm -rf' if you really \"\n-\t\t\t    \"want to remove it including all \"\n-\t\t\t    \"of its history)\"),\n-\t\t\t  &errs);\n-\tstring_list_clear(&files_submodule, 0);\n+\n+\terror_removing_concrete_submodules(&files_submodule, &errs);\n+\n \tprint_error_files(&files_local,\n \t\t\t  Q_(\"the following file has local modifications:\",\n \t\t\t     \"the following files have local modifications:\",\n"},{"id":"224567","messageId":"vpqhaf44fdu.fsf@anie.imag.fr","threadId":"34538","inReplyTo":"7v1u6l501r.fsf@alter.siamese.dyndns.org","subject":"Re: redundant message in builtin/rm.c","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-05T10:10:37Z","receivedAt":"2013-08-05T10:10:37Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Thanks both.  Perhaps we should do something like this?\n>\n> -- >8 --\n> Subject: builtin/rm.c: consolidate error reporting for removing submodules\n\nSounds good, yes.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}