Stefan Beller <sbel...@google.com> writes:

> @@ -375,6 +378,7 @@ static void emit_other(struct blame_scoreboard *sb, 
> struct blame_entry *ent, int
>       struct commit_info ci;
>       char hex[GIT_MAX_HEXSZ + 1];
>       int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
> +     const char *color = NULL, *reset = NULL;
>  
>       get_commit_info(suspect->commit, &ci, 1);
>       oid_to_hex_r(hex, &suspect->commit->object.oid);
> @@ -384,6 +388,18 @@ static void emit_other(struct blame_scoreboard *sb, 
> struct blame_entry *ent, int
>               char ch;
>               int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? GIT_SHA1_HEXSZ : 
> abbrev;
>  
> +             if (opt & OUTPUT_COLOR_LINE) {
> +                     if (cnt > 0) {
> +                             color = repeated_meta_color;
> +                             reset = GIT_COLOR_RESET;
> +                     } else  {
> +                             color = "";
> +                             reset = "";

Shouldn't these be NULL as you do not want to fputs() these when not
in painting mode anyway?  Which would make it consistent with ...

> +                     }
> +             }
> +             if (color)
> +                     fputs(color, stdout);
> +

... this thing which otherwise needs to be "if (color && *color)",
but if you do NULL, can be left as-is ;-)

> @@ -433,6 +449,8 @@ static void emit_other(struct blame_scoreboard *sb, 
> struct blame_entry *ent, int
>                       printf(" %*d) ",
>                              max_digits, ent->lno + 1 + cnt);
>               }
> +             if (reset)
> +                     fputs(reset, stdout);

Likewise.

Reply via email to