From 1a60f2066aadf68391aed69f4d5914d914b60f5b Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 5 Sep 2024 04:51:49 -0400 Subject: drop trailing newline from warning/error/die messages Our error reporting routines append a trailing newline, and the strings we pass to them should not include them (otherwise we get an extra blank line after the message). These cases were all found by looking at the results of: git grep -P '[^_](error|error_errno|warning|die|die_errno)\(.*\\n"[,)]' '*.c' Note that we _do_ sometimes include a newline in the middle of such messages, to create multiline output (hence our grep matching "," or ")" after we see the newline, so we know we're at the end of the string). It's possible that one or more of these cases could intentionally be including a blank line at the end, but having looked at them all manually, I think these are all just mistakes. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/helper/test-path-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't/helper/test-path-utils.c') diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c index bf0e23ed50..fd6e6cc4a5 100644 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@ -38,7 +38,7 @@ static void normalize_argv_string(const char **var, const char *input) *var = input; if (*var && (**var == '<' || **var == '(')) - die("Bad value: %s\n", input); + die("Bad value: %s", input); } struct test_data { @@ -78,12 +78,12 @@ static int test_function(struct test_data *data, char *(*func)(char *input), if (!strcmp(to, data[i].to)) continue; if (!data[i].alternative) - error("FAIL: %s(%s) => '%s' != '%s'\n", + error("FAIL: %s(%s) => '%s' != '%s'", funcname, data[i].from, to, data[i].to); else if (!strcmp(to, data[i].alternative)) continue; else - error("FAIL: %s(%s) => '%s' != '%s', '%s'\n", + error("FAIL: %s(%s) => '%s' != '%s', '%s'", funcname, data[i].from, to, data[i].to, data[i].alternative); failed = 1; -- cgit v1.2.3