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

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

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