Re: [PATCH v6 02/10] ref-filter: add option to pad atoms to the right
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 29, 2015, 19:29 UTC
- Message-ID
- <CAPig+cS4zVT2=kuV3yc860vp4fKrqzvM_phyNngSUho9zTzStA@mail.gmail.com>
- In-Reply-To
- <1438065211-3777-2-git-send-email-Karthik.188@gmail.com>
On Tuesday, July 28, 2015, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 30 quoted lines
> 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).
Show 6 quoted lines
> + test_cmp expect actual > +' > + > test_done > -- > 2.4.6