trace2: trim trailing whitespace in normal format error message

Avoid creating unnecessary trailing whitespace in normal
target format error messages when the message is omitted.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff Hostetler 2019-08-08 07:19:02 -07:00 committed by Junio C Hamano
parent 04f10d332f
commit ad43e37839
1 changed files with 5 additions and 2 deletions

View File

@ -142,8 +142,11 @@ static void fn_error_va_fl(const char *file, int line, const char *fmt,
{
struct strbuf buf_payload = STRBUF_INIT;
strbuf_addstr(&buf_payload, "error ");
maybe_append_string_va(&buf_payload, fmt, ap);
strbuf_addstr(&buf_payload, "error");
if (fmt && *fmt) {
strbuf_addch(&buf_payload, ' ');
maybe_append_string_va(&buf_payload, fmt, ap);
}
normal_io_write_fl(file, line, &buf_payload);
strbuf_release(&buf_payload);
}