trace: cosmetic fixes for error messages

The error messages for the trace code are often multi-line; the first line gets a nice "warning:", but the rest are left-aligned. Let's give them an indentation to make sure they stand out as a unit. While we're here, let's also downcase the first letter of each error (our usual style), and break up a long line of advice (since we're already using multiple lines, one more doesn't hurt). We also replace "What does 'foo' for GIT_TRACE mean?". While cute, it's probably a good idea to give more context, and follow our usual styles. So it's now "unknown trace value for 'GIT_TRACE': foo". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 3, 2016 at 19:00 UTC b3a1c5da0242c936bfc007722aa0011494629b32
1 file changed +8 -8
trace.c
+8 -8
@@ -61,8 +61,8 @@ static int get_trace_fd(struct trace_key *key)
61 else if (is_absolute_path(trace)) {
62 int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
63 if (fd == -1) {
64 - warning("Could not open '%s' for tracing: %s\n"
65 - "Defaulting to tracing on stderr...",
64 + warning("could not open '%s' for tracing: %s\n"
65 + " Defaulting to tracing on stderr...",
66 trace, strerror(errno));
67 key->fd = STDERR_FILENO;
68 } else {
@@ -70,11 +70,11 @@ static int get_trace_fd(struct trace_key *key)
70 key->need_close = 1;
71 }
72 } else {
73 - warning("What does '%s' for %s mean?\n"
74 - "If you want to trace into a file, then please set "
75 - "%s to an absolute pathname (starting with /).\n"
76 - "Defaulting to tracing on stderr...",
77 - trace, key->key, key->key);
73 + warning("unknown trace value for '%s': %s\n"
74 + " If you want to trace into a file, then please set %s\n"
75 + " to an absolute pathname (starting with /)\n"
76 + " Defaulting to tracing on stderr...",
77 + key->key, trace, key->key);
78 key->fd = STDERR_FILENO;
79 }
80
@@ -93,7 +93,7 @@ void trace_disable(struct trace_key *key)
93 key->need_close = 0;
94 }
95
96 -static const char err_msg[] = "Could not trace into fd given by "
96 +static const char err_msg[] = "could not trace into fd given by "
97 "GIT_TRACE environment variable";
98
99 static int prepare_trace_line(const char *file, int line,