{"thread":{"id":"48746","subject":"[PATCH] submodule.c: report the submodule that an error occurs in","startedAt":"2018-06-20T22:33:03Z","lastAt":"2018-06-27T17:02:29Z","messageCount":5,"participants":["Stefan Beller","Junio C Hamano","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"350610","messageId":"20180620223253.226092-1-sbeller@google.com","threadId":"48746","inReplyTo":null,"subject":"[PATCH] submodule.c: report the submodule that an error occurs in","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-06-20T22:32:53Z","receivedAt":"2018-06-20T22:33:03Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"When an error occurs in updating the working tree of a submodule in\nsubmodule_move_head, tell the user which submodule the error occurred in.\n\nThe call to read-tree contains a super-prefix, such that the read-tree\nwill correctly report any path related issues, but some error messages\ndo not contain a path, for example:\n\n  ~/gerrit$ git checkout --recurse-submodules origin/master\n  ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a\n\nGive the hint which submodule has a problem.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n submodule.c               | 2 +-\n t/lib-submodule-update.sh | 3 ++-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex 939d6870ecd..ebd092a14fd 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n \targv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());\n \n \tif (run_command(&cp)) {\n-\t\tret = -1;\n+\t\tret = error(_(\"Submodule '%s' could not be updated.\"), path);\n \t\tgoto out;\n \t}\n \ndiff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\nindex 1f38a85371a..e27f5d8541d 100755\n--- a/t/lib-submodule-update.sh\n+++ b/t/lib-submodule-update.sh\n@@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {\n \t\t(\n \t\t\tcd submodule_update &&\n \t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n-\t\t\ttest_must_fail $command invalid_sub1 &&\n+\t\t\ttest_must_fail $command invalid_sub1 2>err &&\n+\t\t\tgrep sub1 err &&\n \t\t\ttest_superproject_content origin/add_sub1 &&\n \t\t\ttest_submodule_content sub1 origin/add_sub1\n \t\t)\n-- \n2.18.0.rc2.346.g013aa6912e-goog\n\n"},{"id":"350678","messageId":"xmqqvaabrh1d.fsf@gitster-ct.c.googlers.com","threadId":"48746","inReplyTo":"20180620223253.226092-1-sbeller@google.com","subject":"Re: [PATCH] submodule.c: report the submodule that an error occurs in","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-06-21T21:00:46Z","receivedAt":"2018-06-21T21:00:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> When an error occurs in updating the working tree of a submodule in\n> submodule_move_head, tell the user which submodule the error occurred in.\n>\n> The call to read-tree contains a super-prefix, such that the read-tree\n> will correctly report any path related issues, but some error messages\n> do not contain a path, for example:\n>\n>   ~/gerrit$ git checkout --recurse-submodules origin/master\n>   ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a\n>\n> Give the hint which submodule has a problem.\n>\n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n>  submodule.c               | 2 +-\n>  t/lib-submodule-update.sh | 3 ++-\n>  2 files changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/submodule.c b/submodule.c\n> index 939d6870ecd..ebd092a14fd 100644\n> --- a/submodule.c\n> +++ b/submodule.c\n> @@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n>  \targv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());\n>  \n>  \tif (run_command(&cp)) {\n> -\t\tret = -1;\n> +\t\tret = error(_(\"Submodule '%s' could not be updated.\"), path);\n>  \t\tgoto out;\n>  \t}\n\nOK.  The function uses path in messages elsewhere so we know path\nmust not be empty and have a reasonable string content at this\npoint, which makes this a reasonably safe patch to apply ;-)\n\nThanks.\n\n> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\n> index 1f38a85371a..e27f5d8541d 100755\n> --- a/t/lib-submodule-update.sh\n> +++ b/t/lib-submodule-update.sh\n> @@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {\n>  \t\t(\n>  \t\t\tcd submodule_update &&\n>  \t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n> -\t\t\ttest_must_fail $command invalid_sub1 &&\n> +\t\t\ttest_must_fail $command invalid_sub1 2>err &&\n> +\t\t\tgrep sub1 err &&\n>  \t\t\ttest_superproject_content origin/add_sub1 &&\n>  \t\t\ttest_submodule_content sub1 origin/add_sub1\n>  \t\t)\n"},{"id":"350714","messageId":"20180622081713.5360-1-szeder.dev@gmail.com","threadId":"48746","inReplyTo":"20180620223253.226092-1-sbeller@google.com","subject":"Re: [PATCH] submodule.c: report the submodule that an error occurs in","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-06-22T08:17:13Z","receivedAt":"2018-06-22T08:17:24Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\n> When an error occurs in updating the working tree of a submodule in\n> submodule_move_head, tell the user which submodule the error occurred in.\n> \n> The call to read-tree contains a super-prefix, such that the read-tree\n> will correctly report any path related issues, but some error messages\n> do not contain a path, for example:\n> \n>   ~/gerrit$ git checkout --recurse-submodules origin/master\n>   ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a\n> \n> Give the hint which submodule has a problem.\n> \n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n>  submodule.c               | 2 +-\n>  t/lib-submodule-update.sh | 3 ++-\n>  2 files changed, 3 insertions(+), 2 deletions(-)\n> \n> diff --git a/submodule.c b/submodule.c\n> index 939d6870ecd..ebd092a14fd 100644\n> --- a/submodule.c\n> +++ b/submodule.c\n> @@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n>  \targv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());\n>  \n>  \tif (run_command(&cp)) {\n> -\t\tret = -1;\n> +\t\tret = error(_(\"Submodule '%s' could not be updated.\"), path);\n\nThis is a translated error message ...\n\n>  \t\tgoto out;\n>  \t}\n>  \n> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\n> index 1f38a85371a..e27f5d8541d 100755\n> --- a/t/lib-submodule-update.sh\n> +++ b/t/lib-submodule-update.sh\n> @@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {\n>  \t\t(\n>  \t\t\tcd submodule_update &&\n>  \t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n> -\t\t\ttest_must_fail $command invalid_sub1 &&\n> +\t\t\ttest_must_fail $command invalid_sub1 2>err &&\n> +\t\t\tgrep sub1 err &&\n\n... so the test should use 'test_i18ngrep' to check it.\n\n>  \t\t\ttest_superproject_content origin/add_sub1 &&\n>  \t\t\ttest_submodule_content sub1 origin/add_sub1\n>  \t\t)\n> -- \n> 2.18.0.rc2.346.g013aa6912e-goog\n> \n> \n"},{"id":"350835","messageId":"xmqqmuviq2n7.fsf@gitster-ct.c.googlers.com","threadId":"48746","inReplyTo":"20180622081713.5360-1-szeder.dev@gmail.com","subject":"Re: [PATCH] submodule.c: report the submodule that an error occurs in","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-06-25T15:58:20Z","receivedAt":"2018-06-25T15:58:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n>> When an error occurs in updating the working tree of a submodule in\n>> submodule_move_head, tell the user which submodule the error occurred in.\n>> \n>> The call to read-tree contains a super-prefix, such that the read-tree\n>> will correctly report any path related issues, but some error messages\n>> do not contain a path, for example:\n>> \n>>   ~/gerrit$ git checkout --recurse-submodules origin/master\n>>   ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a\n>> \n>> Give the hint which submodule has a problem.\n>> \n>> Signed-off-by: Stefan Beller <sbeller@google.com>\n>> ---\n>>  submodule.c               | 2 +-\n>>  t/lib-submodule-update.sh | 3 ++-\n>>  2 files changed, 3 insertions(+), 2 deletions(-)\n>> \n>> diff --git a/submodule.c b/submodule.c\n>> index 939d6870ecd..ebd092a14fd 100644\n>> --- a/submodule.c\n>> +++ b/submodule.c\n>> @@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n>>  \targv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());\n>>  \n>>  \tif (run_command(&cp)) {\n>> -\t\tret = -1;\n>> +\t\tret = error(_(\"Submodule '%s' could not be updated.\"), path);\n>\n> This is a translated error message ...\n>\n>>  \t\tgoto out;\n>>  \t}\n>>  \n>> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\n>> index 1f38a85371a..e27f5d8541d 100755\n>> --- a/t/lib-submodule-update.sh\n>> +++ b/t/lib-submodule-update.sh\n>> @@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {\n>>  \t\t(\n>>  \t\t\tcd submodule_update &&\n>>  \t\t\tgit branch -t invalid_sub1 origin/invalid_sub1 &&\n>> -\t\t\ttest_must_fail $command invalid_sub1 &&\n>> +\t\t\ttest_must_fail $command invalid_sub1 2>err &&\n>> +\t\t\tgrep sub1 err &&\n>\n> ... so the test should use 'test_i18ngrep' to check it.\n\nThanks for being a careful reviewer, as always.\n\nWill tweak locally to skip one round-trip.\n\n"},{"id":"351122","messageId":"CAGZ79kamPSvDT+qjjF+KmvXqq2HmVoSDaGGnQ3YbiAUFSm-+1Q@mail.gmail.com","threadId":"48746","inReplyTo":"xmqqmuviq2n7.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] submodule.c: report the submodule that an error occurs in","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-06-27T17:02:14Z","receivedAt":"2018-06-27T17:02:29Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Jun 25, 2018 at 8:58 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> SZEDER Gábor <szeder.dev@gmail.com> writes:\n>\n> >> When an error occurs in updating the working tree of a submodule in\n> >> submodule_move_head, tell the user which submodule the error occurred in.\n> >>\n> >> The call to read-tree contains a super-prefix, such that the read-tree\n> >> will correctly report any path related issues, but some error messages\n> >> do not contain a path, for example:\n> >>\n> >>   ~/gerrit$ git checkout --recurse-submodules origin/master\n> >>   ~/gerrit$ fatal: failed to unpack tree object 07672f31880ba80300b38492df9d0acfcd6ee00a\n> >>\n> >> Give the hint which submodule has a problem.\n> >>\n> >> Signed-off-by: Stefan Beller <sbeller@google.com>\n> >> ---\n> >>  submodule.c               | 2 +-\n> >>  t/lib-submodule-update.sh | 3 ++-\n> >>  2 files changed, 3 insertions(+), 2 deletions(-)\n> >>\n> >> diff --git a/submodule.c b/submodule.c\n> >> index 939d6870ecd..ebd092a14fd 100644\n> >> --- a/submodule.c\n> >> +++ b/submodule.c\n> >> @@ -1668,7 +1668,7 @@ int submodule_move_head(const char *path,\n> >>      argv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());\n> >>\n> >>      if (run_command(&cp)) {\n> >> -            ret = -1;\n> >> +            ret = error(_(\"Submodule '%s' could not be updated.\"), path);\n> >\n> > This is a translated error message ...\n> >\n> >>              goto out;\n> >>      }\n> >>\n> >> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh\n> >> index 1f38a85371a..e27f5d8541d 100755\n> >> --- a/t/lib-submodule-update.sh\n> >> +++ b/t/lib-submodule-update.sh\n> >> @@ -781,7 +781,8 @@ test_submodule_recursing_with_args_common() {\n> >>              (\n> >>                      cd submodule_update &&\n> >>                      git branch -t invalid_sub1 origin/invalid_sub1 &&\n> >> -                    test_must_fail $command invalid_sub1 &&\n> >> +                    test_must_fail $command invalid_sub1 2>err &&\n> >> +                    grep sub1 err &&\n> >\n> > ... so the test should use 'test_i18ngrep' to check it.\n>\n> Thanks for being a careful reviewer, as always.\n>\n> Will tweak locally to skip one round-trip.\n\nThanks for tweaking locally. I reviewed your queued patch and\nit looks good to me. Thanks!\n\nI remember deliberately not using the i18n grep as we grep for\na part that should stay the same in all languages. However I\nforgot that details of the test suite implementation (it doesn't\nhave a real translation, so it doesn't matter that this particular\npiece of the message will show up in all translations)\n\nSorry for my mishap in thinking there.\n\nThanks,\nStefan\n"}]}