Re: [RFC/PATCH 02/11] ref-filter: add 'colornext' atom
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 28, 2015, 16:03 UTC
- Message-ID
- <CAOLa=ZSDQLWF=ZsSeJ0rCtqTxh23bKSSSRfj9mGYaVJiMYbj8w@mail.gmail.com>
- In-Reply-To
- <vpqd1zc1xik.fsf@anie.imag.fr>
On Tue, Jul 28, 2015 at 2:15 PM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
Show 30 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> --- a/t/t6302-for-each-ref-filter.sh
>> +++ b/t/t6302-for-each-ref-filter.sh
>> @@ -133,4 +133,20 @@ test_expect_success 'reverse version sort' '
>> test_cmp expect actual
>> '
>>
>> +get_color ()
>> +{
>> + git config --get-color no.such.slot "$1"
>> +}
>> +
>> +cat >expect <<EOF &&
>> +$(get_color green)foo1.10$(get_color reset)||
>> +$(get_color green)foo1.3$(get_color reset)||
>> +$(get_color green)foo1.6$(get_color reset)||
>> +EOF
>> +
>> +test_expect_success 'check `colornext` format option' '
>> + git for-each-ref --format="%(colornext:green)%(refname:short)||" | grep "foo" >actual &&
>> + test_cmp expect actual
>> +'
>
> This is not a very good test: you're not checking that colornext applies
> to the next and only this one. Similarly to what I suggested for
> padright, I'd suggest
>
> --format="%(refname:short)%(colornext:green)|%(refname:short)|%(refname:short)|"
>That was the purpose of the "||" but that doesn't check the color of next atom, Thanks for the example will use that :)
-- Regards, Karthik Nayak