Re: [PATCH v6 02/10] ref-filter: add option to pad atoms to the right
On Thu, Jul 30, 2015 at 12:59 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 36 quoted lines
> On Tuesday, July 28, 2015, Karthik Nayak <karthik.188@gmail.com> wrote:
>> Add a new atom "padright" and support %(padright:X) where X is a
>> number. This will align the succeeding atom value to the left
>> followed by spaces for a total length of X characters. If X is less
>> than the item size, the entire atom value is printed.
>>
>> Add tests and documentation for the same.
>>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>> diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
>> index 505a360..19ac480 100755
>> --- a/t/t6302-for-each-ref-filter.sh
>> +++ b/t/t6302-for-each-ref-filter.sh
>> @@ -81,4 +81,20 @@ test_expect_success 'filtering with --contains' '
>> test_cmp expect actual
>> '
>>
>> +test_expect_success 'padding to the right using `padright`' '
>> + cat >expect <<-\EOF &&
>> + refs/heads/master|refs/heads/master |refs/heads/master|
>> + refs/heads/side|refs/heads/side |refs/heads/side|
>> + refs/odd/spot|refs/odd/spot |refs/odd/spot|
>> + refs/tags/double-tag|refs/tags/double-tag |refs/tags/double-tag|
>> + refs/tags/four|refs/tags/four |refs/tags/four|
>> + refs/tags/one|refs/tags/one |refs/tags/one|
>> + refs/tags/signed-tag|refs/tags/signed-tag |refs/tags/signed-tag|
>> + refs/tags/three|refs/tags/three |refs/tags/three|
>> + refs/tags/two|refs/tags/two |refs/tags/two|
>> + EOF
>> + git for-each-ref --format="%(refname)%(padright:25)|%(refname)|%(refname)|" >actual &&
>
> This fails to test the important case when the atom length is greater
> than the padright value (in which case no padding should be done, and
> the atom text should extend beyond the 'padright' column).
>
Will add a test for the same, thanks :)
--
Regards,
Karthik Nayak