Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-08-01 Thread Jacob Keller
On Fri, Jul 31, 2015 at 11:46 PM, Karthik Nayak wrote: > On Thu, Jul 30, 2015 at 2:51 AM, Matthieu Moy > wrote: >> Junio C Hamano writes: >> >>> Junio C Hamano writes: >>> > Couldn't think of a better replacer, any suggestions would be welcome :) See below. ... One way t

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-31 Thread Karthik Nayak
On Thu, Jul 30, 2015 at 2:51 AM, Matthieu Moy wrote: > Junio C Hamano writes: > >> Junio C Hamano writes: >> Couldn't think of a better replacer, any suggestions would be welcome :) >>> >>> See below. >>> ... >>> One way to do all of the above is ... >> >> Note that is just "one way", not t

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-31 Thread Karthik Nayak
On Wed, Jul 29, 2015 at 11:30 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >>> A handful of "huh?" on the design. >>> >>> - The atom says "if *exists*" and explanation says "has a value". >>>How are they related? Does an atom whose value is an empty >>>string has a value? Or is

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-29 Thread Junio C Hamano
Matthieu Moy writes: > Junio C Hamano writes: > >> Junio C Hamano writes: >> Couldn't think of a better replacer, any suggestions would be welcome :) >>> >>> See below. >>> ... >>> One way to do all of the above is ... >> >> Note that is just "one way", not the only or not necessarily the

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-29 Thread Matthieu Moy
Junio C Hamano writes: > Junio C Hamano writes: > >>> Couldn't think of a better replacer, any suggestions would be welcome :) >> >> See below. >> ... >> One way to do all of the above is ... > > Note that is just "one way", not the only or not necessarily the > best. It certainly is not the ea

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-29 Thread Junio C Hamano
Junio C Hamano writes: >> Couldn't think of a better replacer, any suggestions would be welcome :) > > See below. > ... > One way to do all of the above is ... Note that is just "one way", not the only or not necessarily the best. It certainly is not the easiest, I think. %(if:atom)...%(en

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-29 Thread Junio C Hamano
Karthik Nayak writes: >> A handful of "huh?" on the design. >> >> - The atom says "if *exists*" and explanation says "has a value". >>How are they related? Does an atom whose value is an empty >>string has a value? Or is "ifexists" meant to be used only to >>ignore meaningless atom

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-29 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 11:27 PM, Junio C Hamano wrote: > Karthik Nayak writes: > >> The 'ifexists' atom allows us to print a required format if the >> preceeding atom has a value. If the preceeding atom has no value then >> the format given is not printed. e.g. to print "[]" we can >> now use th

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-28 Thread Junio C Hamano
Karthik Nayak writes: > The 'ifexists' atom allows us to print a required format if the > preceeding atom has a value. If the preceeding atom has no value then > the format given is not printed. e.g. to print "[]" we can > now use the format "%(ifexists:[%s])%(refname)". A handful of "huh?" on t

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-28 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 2:20 PM, Matthieu Moy wrote: > Karthik Nayak writes: > >> --- a/t/t6302-for-each-ref-filter.sh >> +++ b/t/t6302-for-each-ref-filter.sh >> @@ -149,4 +149,25 @@ test_expect_success 'check `colornext` format option' ' >> test_cmp expect actual >> ' >> >> +test_expect_s

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-28 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 1:24 PM, Jacob Keller wrote: > On Mon, Jul 27, 2015 at 11:56 PM, Karthik Nayak wrote: >> The 'ifexists' atom allows us to print a required format if the >> preceeding atom has a value. If the preceeding atom has no value then > > Don't you mean "following atom" here? since

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-28 Thread Matthieu Moy
Karthik Nayak writes: > --- a/t/t6302-for-each-ref-filter.sh > +++ b/t/t6302-for-each-ref-filter.sh > @@ -149,4 +149,25 @@ test_expect_success 'check `colornext` format option' ' > test_cmp expect actual > ' > > +test_expect_success 'check `ifexists` format option' ' > + cat >expect

Re: [RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-28 Thread Jacob Keller
On Mon, Jul 27, 2015 at 11:56 PM, Karthik Nayak wrote: > The 'ifexists' atom allows us to print a required format if the > preceeding atom has a value. If the preceeding atom has no value then Don't you mean "following atom" here? since you do document it as "the next atom" below you should fix t

[RFC/PATCH 04/11] ref-filter: add 'ifexists' atom

2015-07-27 Thread Karthik Nayak
The 'ifexists' atom allows us to print a required format if the preceeding atom has a value. If the preceeding atom has no value then the format given is not printed. e.g. to print "[]" we can now use the format "%(ifexists:[%s])%(refname)". Add documentation and test for the same. Mentored-by: C