Re: [PATCH 6/9] for-each-ref: add %(color:...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy wrote:
> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
> index b10d48a..db5c211 100644
> --- a/builtin/for-each-ref.c
> +++ b/builtin/for-each-ref.c
> @@ -78,6 +81,7 @@ static struct {
>         { "current" },
>         { "tracking" },
>         { "tracking:upstream" },
> +       { "color" },
>  };

No, I intentionally did not make color an atom in $gmane/224692.  It
doesn't print any information about the branch, like the other atoms
do: have it augment the final printing.

>  /*
> @@ -707,6 +711,21 @@ static void populate_value(struct refinfo *ref)
>                         v->s = sb.buf;
>                         continue;
>                 }
> +               else if (!prefixcmp(name, "color:")) {
> +                       const char *color = name + 6;
> +                       ref->auto_color = 0;
> +                       if (!prefixcmp(color, "red"))
> +                               v->s = GIT_COLOR_RED;
> +                       else if (!prefixcmp(color, "green"))
> +                               v->s = GIT_COLOR_GREEN;
> +                       else if (!prefixcmp(color, "blue"))
> +                               v->s = GIT_COLOR_BLUE;
> +                       else if (!prefixcmp(color, "reset"))
> +                               v->s = GIT_COLOR_RESET;
> +                       else if (!prefixcmp(color, "auto"))
> +                               ref->auto_color = 1;
> +                       continue;
> +               }

So I can't have %(color:yellow)? :(
Why are you parsing it here when you can use color_parse_name()?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]