зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
38f460caa2
Коммит
b3a1c5da02
16
trace.c
16
trace.c
|
@ -61,8 +61,8 @@ static int get_trace_fd(struct trace_key *key)
|
||||||
else if (is_absolute_path(trace)) {
|
else if (is_absolute_path(trace)) {
|
||||||
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
|
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
warning("Could not open '%s' for tracing: %s\n"
|
warning("could not open '%s' for tracing: %s\n"
|
||||||
"Defaulting to tracing on stderr...",
|
" Defaulting to tracing on stderr...",
|
||||||
trace, strerror(errno));
|
trace, strerror(errno));
|
||||||
key->fd = STDERR_FILENO;
|
key->fd = STDERR_FILENO;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,11 +70,11 @@ static int get_trace_fd(struct trace_key *key)
|
||||||
key->need_close = 1;
|
key->need_close = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("What does '%s' for %s mean?\n"
|
warning("unknown trace value for '%s': %s\n"
|
||||||
"If you want to trace into a file, then please set "
|
" If you want to trace into a file, then please set %s\n"
|
||||||
"%s to an absolute pathname (starting with /).\n"
|
" to an absolute pathname (starting with /)\n"
|
||||||
"Defaulting to tracing on stderr...",
|
" Defaulting to tracing on stderr...",
|
||||||
trace, key->key, key->key);
|
key->key, trace, key->key);
|
||||||
key->fd = STDERR_FILENO;
|
key->fd = STDERR_FILENO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void trace_disable(struct trace_key *key)
|
||||||
key->need_close = 0;
|
key->need_close = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char err_msg[] = "Could not trace into fd given by "
|
static const char err_msg[] = "could not trace into fd given by "
|
||||||
"GIT_TRACE environment variable";
|
"GIT_TRACE environment variable";
|
||||||
|
|
||||||
static int prepare_trace_line(const char *file, int line,
|
static int prepare_trace_line(const char *file, int line,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче