git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] submodule: add newline on invalid submodule error
@ 2020-02-07  0:48 Emily Shaffer
  2020-02-07 13:55 ` Derrick Stolee
  0 siblings, 1 reply; 2+ messages in thread
From: Emily Shaffer @ 2020-02-07  0:48 UTC (permalink / raw)
  To: git; +Cc: Emily Shaffer

Since 'err' contains output for multiple submodules and is printed all
at once by fetch_populated_submodules(), errors for each submodule
should be newline separated for readability. The same strbuf is added to
with a newline in the other half of the conditional where this error is
detected, so make the two consistent.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 submodule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/submodule.c b/submodule.c
index 3a184b66ab..d63f4476d9 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1480,7 +1480,7 @@ static int get_next_submodule(struct child_process *cp,
 			    !is_empty_dir(ce->name)) {
 				spf->result = 1;
 				strbuf_addf(err,
-					    _("Could not access submodule '%s'"),
+					    _("Could not access submodule '%s'\n"),
 					    ce->name);
 			}
 		}
-- 
2.25.0.341.g760bfbb309-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] submodule: add newline on invalid submodule error
  2020-02-07  0:48 [PATCH] submodule: add newline on invalid submodule error Emily Shaffer
@ 2020-02-07 13:55 ` Derrick Stolee
  0 siblings, 0 replies; 2+ messages in thread
From: Derrick Stolee @ 2020-02-07 13:55 UTC (permalink / raw)
  To: Emily Shaffer, git

On 2/6/2020 7:48 PM, Emily Shaffer wrote:
> Since 'err' contains output for multiple submodules and is printed all
> at once by fetch_populated_submodules(), errors for each submodule
> should be newline separated for readability. The same strbuf is added to
> with a newline in the other half of the conditional where this error is
> detected, so make the two consistent.

A worthy goal, and thanks for pointing out that this matches the
"Fetching submodule %s%s\n" string in the other block.

> -					    _("Could not access submodule '%s'"),
> +					    _("Could not access submodule '%s'\n"),

My initial thought was that this `\n` should be added in front of the
string, and only if the string has existing data. However, that's not
what happens in the other block, so doing it that way would require
changing both places. This approach is also less error-prone, even if
it may result in an "extra" newline at the end of all the messages.

LGTM.

Thanks,
-Stolee


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-07 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  0:48 [PATCH] submodule: add newline on invalid submodule error Emily Shaffer
2020-02-07 13:55 ` Derrick Stolee

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).