Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-17 Thread Karthik Nayak
On Sat, Apr 16, 2016 at 5:41 AM, Stefan Beller wrote: >> static int calc_maxwidth(struct ref_array *refs, int remote_bonus) >> { >> int i, max = 0; >> @@ -432,7 +281,10 @@ static int calc_maxwidth(struct ref_array *refs, int >> remote_bonus) >> >> skip_prefix(it->refname

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-15 Thread Stefan Beller
> static int calc_maxwidth(struct ref_array *refs, int remote_bonus) > { > int i, max = 0; > @@ -432,7 +281,10 @@ static int calc_maxwidth(struct ref_array *refs, int > remote_bonus) > > skip_prefix(it->refname, "refs/heads/", &desc); > skip_prefix(it->ref

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-15 Thread Jeff King
On Sat, Apr 16, 2016 at 01:57:23AM +0530, Karthik Nayak wrote: > I had a look at your patch and even tested it, seems solid, I like how you > integrated all these atoms together under refname_atom_parser_internal(). > I'm squashing this in, for my re-roll. Thanks. Great, thanks for picking it up.

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-15 Thread Karthik Nayak
On Fri, Apr 15, 2016 at 2:06 AM, Jeff King wrote: > On Thu, Apr 14, 2016 at 04:05:30PM -0400, Jeff King wrote: > >> It looks like that's a little tricky for %(upstream) and %(push), which >> have extra tracking options, but it's pretty trivial for %(symref): >> [...] >> I suspect it could work for

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-14 Thread Jeff King
On Thu, Apr 14, 2016 at 04:05:30PM -0400, Jeff King wrote: > It looks like that's a little tricky for %(upstream) and %(push), which > have extra tracking options, but it's pretty trivial for %(symref): > [...] > I suspect it could work for the remote_ref_atom_parser, too, if you did > something l

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-14 Thread Jeff King
On Fri, Apr 15, 2016 at 12:47:15AM +0530, Karthik Nayak wrote: > That does make sense, I guess then I'll stick to shortening all symref's > by default and allowing the user to change this if needed via the '--format' > option. Thanks. > About %(symref) not getting enough formatting options, I do

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-14 Thread Karthik Nayak
On Thu, Apr 14, 2016 at 3:35 AM, Jeff King wrote: > > The cross-prefix behavior I put into the test is not something I feel > strongly about; it was mostly just restoring the earlier behavior. I do > think shortening everything is fine, too, as long as there's some way to > get the fully qualified

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-13 Thread Jeff King
On Thu, Apr 14, 2016 at 12:31:41AM +0530, Karthik Nayak wrote: > On Wed, Apr 13, 2016 at 8:42 PM, Junio C Hamano wrote: > >>> Having said that, doesn't this need to be further adjusted for > >>> 95c38fb0 (branch: fix shortening of non-remote symrefs, 2016-04-03)? > >>> > >>> http://thread.gmane.o

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-13 Thread Karthik Nayak
On Wed, Apr 13, 2016 at 8:42 PM, Junio C Hamano wrote: >>> Having said that, doesn't this need to be further adjusted for >>> 95c38fb0 (branch: fix shortening of non-remote symrefs, 2016-04-03)? >>> >>> http://thread.gmane.org/gmane.comp.version-control.git/290622/focus=290624 >>> >> >> That was o

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-13 Thread Karthik Nayak
Hello, On Wed, Apr 13, 2016 at 2:35 AM, Junio C Hamano wrote: > Junio C Hamano writes: > >> Karthik Nayak writes: >> >>> +branch_get_color(BRANCH_COLOR_REMOTE), maxwidth, >>> +remote_prefix, >>> branch_get_color(BRANCH_COLOR_RESET)); >>> +} e

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-12 Thread Junio C Hamano
Junio C Hamano writes: > Karthik Nayak writes: > >> +branch_get_color(BRANCH_COLOR_REMOTE), maxwidth, >> +remote_prefix, >> branch_get_color(BRANCH_COLOR_RESET)); >> +} else { >> +strbuf_addf(&local, >> "%%(refname:strip=2)%s%%(if

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-12 Thread Junio C Hamano
Karthik Nayak writes: > + branch_get_color(BRANCH_COLOR_REMOTE), maxwidth, > + remote_prefix, > branch_get_color(BRANCH_COLOR_RESET)); > + } else { > + strbuf_addf(&local, > "%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symr

[PATCH v4 15/16] branch: use ref-filter printing APIs

2016-04-09 Thread Karthik Nayak
Port branch.c to use ref-filter APIs for printing. This clears out most of the code used in branch.c for printing and replaces them with calls made to the ref-filter library. Introduce build_format() which gets the format required for printing of refs. Make amendments to print_ref_list() to reflec