log-tree: always use return value of strbuf_detach()

strbuf_detach() has been returning a pointer to a buffer even for empty strbufs since 08ad56f3f0 ("strbuf: always return a non-NULL value from strbuf_detach", 2012-10-18). Use that feature in show_log() instead of having it handle empty strbufs specially. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Aug 25, 2019 at 14:53 UTC 82f51af3452bb80e2347bb45dba3e1d2f10d0be7
1 file changed +1 -3
log-tree.c
+1 -3
@@ -677,9 +677,7 @@ void show_log(struct rev_info *opt)
677 raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
678 format_display_notes(&commit->object.oid, &notebuf,
679 get_log_output_encoding(), raw);
680 - ctx.notes_message = notebuf.len
681 - ? strbuf_detach(&notebuf, NULL)
682 - : xcalloc(1, 1);
680 + ctx.notes_message = strbuf_detach(&notebuf, NULL);
681 }
682
683 /*