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

Re: [PATCH v3] clone: add clone.<url>.defaultObjectFilter config

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 6, 2026, 10:39 UTC
Message-ID
<aaqu44_sDJYcftWd@fruit.crustytoothpaste.net>
In-Reply-To
<pull.2058.v3.git.1772780113400.gitgitgadget@gmail.com>
On 2026-03-06 at 06:55:13, Alan Braithwaite via GitGitGadget wrote:
Show 27 quoted lines
> From: Alan Braithwaite <alan@braithwaite.dev>
> 
> Add a new configuration option that lets users specify a default
> partial clone filter per URL pattern.  When cloning a repository
> whose URL matches a configured pattern, git-clone automatically
> applies the filter, equivalent to passing --filter on the command
> line.
> 
>     [clone "https://github.com/"]
>         defaultObjectFilter = blob:limit=5m
> 
>     [clone "https://internal.corp.com/large-project/"]
>         defaultObjectFilter = blob:none
> 
> URL matching uses the existing urlmatch_config_entry() infrastructure,
> following the same rules as http.<url>.* — you can match a domain,
> a namespace path, or a specific project, and the most specific match
> wins.
> 
> The config only affects the initial clone.  Once the clone completes,
> the filter is recorded in remote.<name>.partialCloneFilter, so
> subsequent fetches inherit it automatically.  An explicit --filter
> flag on the command line takes precedence.
> 
> Only the URL-qualified form (clone.<url>.defaultObjectFilter) is
> honored; a bare clone.defaultObjectFilter without a URL subsection
> is ignored.

We've historically not implemented default filtering for clones because it makes it hard to reason about the behaviour of the clone command. For instance, if I have a script that clones a repository, it almost certainly expects a full clone unless it requested something else.

For instance, I run `foo setup` which clones my repository and then I suspend my laptop. I go the airport and get on an airplane which lacks Wi-Fi. I then run `foo blargle`, which operates on the repository, but that fails because it was a partial clone and I'm offline. I didn't realize this wouldn't work because I didn't know that the foo command required a full clone since it's just a script I got from my distro.

We've traditionally placed this kind of customizable configuration into `scalar` instead, which is designed to be configurable and set options for large repositories that would want to control clone and fetch options.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Alan Braithwaite via GitGitGadgetNext: Junio C Hamano
Message 17 of 30 in “fetch, clone: add fetch.blobSizeLimit config”
  1. fetch, clone: add fetch.blobSizeLimit configAlan Braithwaite via GitGitGadget, Mar 1, 2026
  2. Patrick SteinhardtMar 2, 2026
  3. Jeff KingMar 2, 2026
  4. Junio C HamanoMar 2, 2026
  5. Alan BraithwaiteMar 2, 2026
  6. Patrick SteinhardtMar 3, 2026
  7. Alan BraithwaiteMar 3, 2026
  8. Patrick SteinhardtMar 3, 2026
  9. Junio C HamanoMar 3, 2026
  10. Patrick SteinhardtMar 4, 2026
  11. Junio C HamanoMar 3, 2026
  12. Jeff KingMar 3, 2026
  13. clone: add clone.<url>.defaultObjectFilter configAlan Braithwaite via GitGitGadget, Mar 5, 2026
  14. Junio C HamanoMar 5, 2026
  15. Alan BraithwaiteMar 5, 2026
  16. clone: add clone.<url>.defaultObjectFilter configAlan Braithwaite via GitGitGadget, Mar 6, 2026
  17. brian m. carlsonMar 6, 2026
  18. Junio C HamanoMar 6, 2026
  19. Alan BraithwaiteMar 6, 2026
  20. clone: add clone.<url>.defaultObjectFilter configAlan Braithwaite via GitGitGadget, Mar 6, 2026
  21. Junio C HamanoMar 6, 2026
  22. Alan BraithwaiteMar 7, 2026
  23. clone: add clone.<url>.defaultObjectFilter configAlan Braithwaite via GitGitGadget, Mar 7, 2026
  24. Patrick SteinhardtMar 11, 2026
  25. Alan BraithwaiteMar 15, 2026
  26. clone: add clone.<url>.defaultObjectFilter configAlan Braithwaite via GitGitGadget, Mar 15, 2026
  27. Junio C HamanoMar 15, 2026
  28. Patrick SteinhardtMar 16, 2026
  29. Junio C HamanoMay 11, 2026
  30. Patrick SteinhardtMay 11, 2026

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.