{"thread":{"id":"52755","subject":"[PATCH] submodule: add newline on invalid submodule error","startedAt":"2020-02-07T00:48:42Z","lastAt":"2020-02-07T13:55:26Z","messageCount":2,"participants":["Emily Shaffer","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"391289","messageId":"20200207004833.255965-1-emilyshaffer@google.com","threadId":"52755","inReplyTo":null,"subject":"[PATCH] submodule: add newline on invalid submodule error","fromName":"Emily Shaffer","fromEmail":"emilyshaffer@google.com","sentAt":"2020-02-07T00:48:33Z","receivedAt":"2020-02-07T00:48:42Z","isPatch":true,"sender":{"key":"nasamuffin@google.com","avatar":"https://avatars.githubusercontent.com/u/1606826?v=4"},"body":"Since 'err' contains output for multiple submodules and is printed all\nat once by fetch_populated_submodules(), errors for each submodule\nshould be newline separated for readability. The same strbuf is added to\nwith a newline in the other half of the conditional where this error is\ndetected, so make the two consistent.\n\nSigned-off-by: Emily Shaffer <emilyshaffer@google.com>\n---\n submodule.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex 3a184b66ab..d63f4476d9 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1480,7 +1480,7 @@ static int get_next_submodule(struct child_process *cp,\n \t\t\t    !is_empty_dir(ce->name)) {\n \t\t\t\tspf->result = 1;\n \t\t\t\tstrbuf_addf(err,\n-\t\t\t\t\t    _(\"Could not access submodule '%s'\"),\n+\t\t\t\t\t    _(\"Could not access submodule '%s'\\n\"),\n \t\t\t\t\t    ce->name);\n \t\t\t}\n \t\t}\n-- \n2.25.0.341.g760bfbb309-goog\n\n"},{"id":"391324","messageId":"aacd5724-fdb6-832c-4af9-22c1831baea2@gmail.com","threadId":"52755","inReplyTo":"20200207004833.255965-1-emilyshaffer@google.com","subject":"Re: [PATCH] submodule: add newline on invalid submodule error","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-02-07T13:55:12Z","receivedAt":"2020-02-07T13:55:26Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 2/6/2020 7:48 PM, Emily Shaffer wrote:\n> Since 'err' contains output for multiple submodules and is printed all\n> at once by fetch_populated_submodules(), errors for each submodule\n> should be newline separated for readability. The same strbuf is added to\n> with a newline in the other half of the conditional where this error is\n> detected, so make the two consistent.\n\nA worthy goal, and thanks for pointing out that this matches the\n\"Fetching submodule %s%s\\n\" string in the other block.\n\n> -\t\t\t\t\t    _(\"Could not access submodule '%s'\"),\n> +\t\t\t\t\t    _(\"Could not access submodule '%s'\\n\"),\n\nMy initial thought was that this `\\n` should be added in front of the\nstring, and only if the string has existing data. However, that's not\nwhat happens in the other block, so doing it that way would require\nchanging both places. This approach is also less error-prone, even if\nit may result in an \"extra\" newline at the end of all the messages.\n\nLGTM.\n\nThanks,\n-Stolee\n\n"}]}