Skip to content

Commit b3a1c5d

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38f460c commit b3a1c5d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

trace.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ static int get_trace_fd(struct trace_key *key)
6161
else if (is_absolute_path(trace)) {
6262
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
6363
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...",
6666
trace, strerror(errno));
6767
key->fd = STDERR_FILENO;
6868
} else {
6969
key->fd = fd;
7070
key->need_close = 1;
7171
}
7272
} 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);
7878
key->fd = STDERR_FILENO;
7979
}
8080

@@ -93,7 +93,7 @@ void trace_disable(struct trace_key *key)
9393
key->need_close = 0;
9494
}
9595

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 "
9797
"GIT_TRACE environment variable";
9898

9999
static int prepare_trace_line(const char *file, int line,

0 commit comments

Comments
 (0)