aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-09-05 04:51:49 -0400
committerJunio C Hamano <gitster@pobox.com>2024-09-05 09:07:12 -0700
commit1a60f2066aadf68391aed69f4d5914d914b60f5b (patch)
tree3f95d066dcae08cb04c0f51f91fc3d5168ffc679 /t
parent2e7b89e038c0c888acf61f1b4ee5a43d4dd5e94c (diff)
downloadgit-1a60f2066aadf68391aed69f4d5914d914b60f5b.tar.gz
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/helper/test-path-utils.c6
-rw-r--r--t/helper/test-progress.c10
-rw-r--r--t/helper/test-reach.c4
3 files changed, 10 insertions, 10 deletions
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;
diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c
index 66acb6a06c..44be2645e9 100644
--- a/t/helper/test-progress.c
+++ b/t/helper/test-progress.c
@@ -62,13 +62,13 @@ int cmd__progress(int argc, const char **argv)
else if (*end == ' ')
title = string_list_insert(&titles, end + 1)->string;
else
- die("invalid input: '%s'\n", line.buf);
+ die("invalid input: '%s'", line.buf);
progress = start_progress(title, total);
} else if (skip_prefix(line.buf, "progress ", (const char **) &end)) {
uint64_t item_count = strtoull(end, &end, 10);
if (*end != '\0')
- die("invalid input: '%s'\n", line.buf);
+ die("invalid input: '%s'", line.buf);
display_progress(progress, item_count);
} else if (skip_prefix(line.buf, "throughput ",
(const char **) &end)) {
@@ -76,10 +76,10 @@ int cmd__progress(int argc, const char **argv)
byte_count = strtoull(end, &end, 10);
if (*end != ' ')
- die("invalid input: '%s'\n", line.buf);
+ die("invalid input: '%s'", line.buf);
test_ms = strtoull(end + 1, &end, 10);
if (*end != '\0')
- die("invalid input: '%s'\n", line.buf);
+ die("invalid input: '%s'", line.buf);
progress_test_ns = test_ms * 1000 * 1000;
display_throughput(progress, byte_count);
} else if (!strcmp(line.buf, "update")) {
@@ -87,7 +87,7 @@ int cmd__progress(int argc, const char **argv)
} else if (!strcmp(line.buf, "stop")) {
stop_progress(&progress);
} else {
- die("invalid input: '%s'\n", line.buf);
+ die("invalid input: '%s'", line.buf);
}
}
strbuf_release(&line);
diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c
index 7314f6c0d8..995e382863 100644
--- a/t/helper/test-reach.c
+++ b/t/helper/test-reach.c
@@ -67,13 +67,13 @@ int cmd__reach(int ac, const char **av)
peeled = deref_tag_noverify(the_repository, orig);
if (!peeled)
- die("failed to load commit for input %s resulting in oid %s\n",
+ die("failed to load commit for input %s resulting in oid %s",
buf.buf, oid_to_hex(&oid));
c = object_as_type(peeled, OBJ_COMMIT, 0);
if (!c)
- die("failed to load commit for input %s resulting in oid %s\n",
+ die("failed to load commit for input %s resulting in oid %s",
buf.buf, oid_to_hex(&oid));
switch (buf.buf[0]) {