Subject: Re: [PATCH v2 1/1] filter-options: Expand abbreviated numbers

From: SZEDER Gábor <[email-masked]>
Date: Wed, 9 Jan 2019 20:20:01 +0100

On Wed, Jan 09, 2019 at 10:55:43AM -0800, Josh Steadmon wrote:
> On 2019.01.09 13:23, SZEDER Gábor wrote:
> > On Mon, Jan 07, 2019 at 04:17:09PM -0800, Josh Steadmon wrote:
> > > diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
> > > index 5285e7674d..9efb3e9902 100644
> > > --- a/list-objects-filter-options.c
> > > +++ b/list-objects-filter-options.c
> > 
> > > @@ -111,6 +112,21 @@ int opt_parse_list_objects_filter(const struct option *opt,
> > >  	return parse_list_objects_filter(filter_options, arg);
> > >  }
> > >  
> > > +void expand_list_objects_filter_spec(
> > > +	const struct list_objects_filter_options *filter,
> > > +	struct strbuf *expanded_spec)
> > > +{
> > > +	strbuf_init(expanded_spec, strlen(filter->filter_spec));
> > > +	if (filter->choice == LOFC_BLOB_LIMIT)
> > > +		strbuf_addf(expanded_spec, "blob:limit=%lu",
> > > +			    filter->blob_limit_value);
> > > +	else if (filter->choice == LOFC_TREE_DEPTH)
> > > +		strbuf_addf(expanded_spec, "tree:%lu",
> > > +			    filter->tree_exclude_depth);
> > > +	else
> > > +		strbuf_addstr(expanded_spec, filter->filter_spec);
> > > +}
> > > +
> > 
> > All compilers error out with something like this:
> > 
> >   list-objects-filter-options.c: In function
> >   ‘expand_list_objects_filter_spec’:
> >   list-objects-filter-options.c:124:29: error: ‘LOFC_TREE_DEPTH’ undeclared (first use in this function); did you mean ‘LOFC_TREE_NONE’?
> >     else if (filter->choice == LOFC_TREE_DEPTH)
> >                                ^~~~~~~~~~~~~~~
> >                                LOFC_TREE_NONE
> >   list-objects-filter-options.c:124:29: note: each undeclared identifier is reported only once for each function it appears in
> >   list-objects-filter-options.c:126:14: error: ‘const struct list_objects_filter_options’ has no member named ‘tree_exclude_depth’
> >           filter->tree_exclude_depth);
> >                 ^~
> >   make: *** [list-objects-filter-options.o] Error 1
> > 
> 
> Hmm, looks like you may not have applied this on top of
> md/list-objects-filter-by-depth? However, the most recent version of
> that branch has its own compilation errors at the moment.

Ah, OK.  I didn't actually apply this patch anywhere, I just tried to
test this topic as it is in 'pu', where it branches off from current
'master'.