git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/4] upload-pack.c: allow banning certain object filter(s)

From
Taylor Blau <me@ttaylorr.com>
Date
Jul 20, 2020, 20:05 UTC
Message-ID
<20200720200528.GA91942@syl.lan>
In-Reply-To
<20200708084527.GB2324177@coredump.intra.peff.net>
On Wed, Jul 08, 2020 at 04:45:27AM -0400, Jeff King wrote:
Show 21 quoted lines
> On Thu, Jul 02, 2020 at 04:06:32PM -0400, Taylor Blau wrote:
>
> > +static void parse_object_filter_config(const char *var, const char *value,
> > +				       struct upload_pack_data *data)
> > +{
> > +	struct strbuf spec = STRBUF_INIT;
> > +	const char *sub, *key;
> > +	size_t sub_len;
> > +
> > +	if (parse_config_key(var, "uploadpack", &sub, &sub_len, &key))
> > +		return;
> > +	if (!sub || !skip_prefix(sub, "filter.", &sub))
> > +		return;
>
> Just while I'm thinking about the config name and case-sensitivity (from
> the cover letter): if we did want to use this scheme, then
> skip_iprefix() would make this behave more like a regular part of the
> section name.
>
> But I'd prefer to just do away with it by using a scheme that doesn't
> have the extra layer of dots.

Yeah. I definitely flip-flopped on this when preparing this for the list. I still feel like 'uploadpackfilter' is gross, so I was hoping to send it with 'uploadpack.filter' (which reads nicely, but forces us to write some gross code), but both options are frustrating to me for different reasons.

Playing around with it more, though, I think that uploadpackfilter is our best bet. I'd hate to introduce a string manipulation bug by munging the reuslt of 'parse_config_key()', which is so clearly designed for something like 'uploadpackfilter[.<filter>].allow'.

Show 7 quoted lines
> > +	if (sub != key)
> > +		strbuf_add(&spec, sub, key - sub - 1);
> > +	strbuf_tolower(&spec);
>
> On the flip side, I'd actually consider _not_ matching the filter name
> case-insensitively. We don't do so elsewhere (e.g., "git rev-list
> --filter=BLOB:NONE" will complain).

I dropped the case-insensitive matching in the latest revision. I don't think that we need to be overly accommodating here.

> -Peff

Thanks, Taylor

Previous: Jeff KingNext: SZEDER Gábor
Message 5 of 25 in “upload-pack: custom allowed object filters”
  1. 0/4 upload-pack: custom allowed object filtersTaylor Blau, Jul 2, 2020
  2. 1/4 list_objects_filter_options: introduce 'list_object_filter_config_name'Taylor Blau, Jul 2, 2020
  3. 2/4 upload-pack.c: allow banning certain object filter(s)Taylor Blau, Jul 2, 2020
  4. Jeff KingJul 8, 2020
  5. Taylor BlauJul 20, 2020
  6. SZEDER GáborJul 15, 2020
  7. Jeff KingJul 15, 2020
  8. Taylor BlauJul 20, 2020
  9. Jeff KingJul 20, 2020
  10. SZEDER GáborJul 22, 2020
  11. Taylor BlauJul 22, 2020
  12. Junio C HamanoJul 23, 2020
  13. Taylor BlauJul 23, 2020
  14. SZEDER GáborJul 22, 2020
  15. Taylor BlauJul 22, 2020
  16. SZEDER GáborJul 23, 2020
  17. Taylor BlauJul 23, 2020
  18. 3/4 upload-pack.c: pass 'struct list_objects_filter_options *'Taylor Blau, Jul 2, 2020
  19. 4/4 upload-pack.c: introduce 'uploadpack.filter.tree.maxDepth'Taylor Blau, Jul 2, 2020
  20. SZEDER GáborJul 15, 2020
  21. Jeff KingJul 8, 2020
  22. Taylor BlauJul 20, 2020
  23. Junio C HamanoJul 21, 2020
  24. Taylor BlauJul 21, 2020
  25. Junio C HamanoJul 21, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.