Re: [PATCH v6 02/10] ref-filter: add option to pad atoms to the right

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

 



On Thu, Jul 30, 2015 at 12:59 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Tuesday, July 28, 2015, Karthik Nayak <karthik.188@xxxxxxxxx> 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@xxxxxxxxx>
>> ---
>> 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
--
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]