Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-23 Thread Karthik Nayak
On Thu, Jul 23, 2015 at 12:14 AM, Matthieu Moy wrote: > Karthik Nayak writes: > >> + strtoul_ui(valp, 10, &ref->align_value); >> + if (ref->align_value < 1) >> + die(_("Value should be greater than zero")); > > You're not checkin

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-22 Thread Matthieu Moy
Karthik Nayak writes: > + strtoul_ui(valp, 10, &ref->align_value); > + if (ref->align_value < 1) > + die(_("Value should be greater than zero")); You're not checking the return value of strtoul_ui, which returns -1 before assign

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-21 Thread Karthik Nayak
On Mon, Jul 20, 2015 at 10:59 PM, Junio C Hamano wrote: > Junio C Hamano writes: > >> Your caller is iterating over the elements in a format string, >> e.g. 'A %(align:20)%(foo) B %(bar) C', and its caller is iterating >> over a list of refs, e.g. 'maint', 'master' branches. With that >> format

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Karthik Nayak
On Mon, Jul 20, 2015 at 11:31 PM, Eric Sunshine wrote: > On Mon, Jul 20, 2015 at 1:22 PM, Karthik Nayak wrote: >> Add a new atom "align" and support %(align:X) where X is a number. >> This will align the preceeding atom value to the left followed by >> spaces for a total length of X characters. I

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Eric Sunshine
On Mon, Jul 20, 2015 at 1:22 PM, Karthik Nayak wrote: > Add a new atom "align" and support %(align:X) where X is a number. > This will align the preceeding 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 pr

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Eric Sunshine
On Mon, Jul 20, 2015 at 12:12 PM, Junio C Hamano wrote: > Eric Sunshine writes: > >> On Sat, Jul 18, 2015 at 3:12 PM, Karthik Nayak wrote: >>> Add a new atom "align" and support %(align:X) where X is a number. >>> This will align the preceeding atom value to the left followed by >>> spaces for a

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Junio C Hamano
Junio C Hamano writes: > Your caller is iterating over the elements in a format string, > e.g. 'A %(align:20)%(foo) B %(bar) C', and its caller is iterating > over a list of refs, e.g. 'maint', 'master' branches. With that > format string, as long as %(foo) does not expand to something that > ex

[PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Karthik Nayak
From: Karthik Nayak Add a new atom "align" and support %(align:X) where X is a number. This will align the preceeding 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. Helped-by: Duy Nguyen Mentored-b

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Karthik Nayak
> > What is your plan for this function? Is it envisioned that this > will gain more variations of formatting options over time? > Otherwise it seems misnamed (it is not "assign formatting" but > merely "pad to the right"). > I wanna include an 'ifexists' atom in the future where an user can spec

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Junio C Hamano
Karthik Nayak writes: > @@ -687,6 +690,17 @@ static void populate_value(struct ref_array_item *ref) > else > v->s = " "; > continue; > + } else if (starts_with(name, "align:")) { > + const ch

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Junio C Hamano
Eric Sunshine writes: > On Sat, Jul 18, 2015 at 3:12 PM, Karthik Nayak wrote: >> Add a new atom "align" and support %(align:X) where X is a number. >> This will align the preceeding atom value to the left followed by >> spaces for a total length of X characters. If X is less than the item >> siz

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-20 Thread Karthik Nayak
On Mon, Jul 20, 2015 at 5:19 AM, Eric Sunshine wrote: > On Sat, Jul 18, 2015 at 3:12 PM, Karthik Nayak wrote: >> Add a new atom "align" and support %(align:X) where X is a number. >> This will align the preceeding atom value to the left followed by >> spaces for a total length of X characters. If

Re: [PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-19 Thread Eric Sunshine
On Sat, Jul 18, 2015 at 3:12 PM, Karthik Nayak wrote: > Add a new atom "align" and support %(align:X) where X is a number. > This will align the preceeding 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 pr

[PATCH v3 1/9] ref-filter: add option to align atoms to the left

2015-07-18 Thread Karthik Nayak
From: Karthik Nayak Add a new atom "align" and support %(align:X) where X is a number. This will align the preceeding 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. Helped-by: Duy Nguyen Mentored-b