sequencer: silence -Wtautological-constant-out-of-range-compare
[gitweb.git] / pretty.c
index 493edb0a446ec0019e39e8f4f2ca8a4e108c40f5..25efbcac9206e82343f954405176fbf477055903 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1072,7 +1072,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
        case 'C':
                if (starts_with(placeholder + 1, "(auto)")) {
                        c->auto_color = want_color(c->pretty_ctx->color);
-                       if (c->auto_color)
+                       if (c->auto_color && sb->len)
                                strbuf_addstr(sb, GIT_COLOR_RESET);
                        return 7; /* consumed 7 bytes, "C(auto)" */
                } else {