Commit 8d656a9
committed
fetch, clone: add fetch.blobSizeLimit config
External tools like git-lfs and git-fat use the filter clean/smudge
mechanism to manage large binary objects, but this requires pointer
files, a separate storage backend, and careful coordination. Git's
partial clone infrastructure provides a more native approach: large
blobs can be excluded at the protocol level during fetch and lazily
retrieved on demand. However, enabling this requires passing
`--filter=blob:limit=<size>` on every clone, which is not
discoverable and cannot be set as a global default.
Add a new `fetch.blobSizeLimit` configuration option that enables
size-based partial clone behavior globally. When set, both `git
clone` and `git fetch` automatically apply a `blob:limit=<size>`
filter. Blobs larger than the threshold that are not needed for the
current worktree are excluded from the transfer and lazily fetched
on demand when needed (e.g., during checkout, diff, or merge).
This makes it easy to work with repositories that have accumulated
large binary files in their history, without downloading all of
them upfront.
The precedence order is:
1. Explicit `--filter=` on the command line (highest)
2. Existing `remote.<name>.partialclonefilter`
3. `fetch.blobSizeLimit` (new, lowest)
Once a clone or fetch applies this setting, the remote is registered
as a promisor remote with the corresponding filter spec, so
subsequent fetches inherit it automatically. If the server does not
support object filtering, the setting is silently ignored.
Signed-off-by: Alan Braithwaite <alan@braithwaite.dev>1 parent 7b2bccb commit 8d656a9
File tree
4 files changed
+135
-10
lines changed- Documentation/config
- builtin
- t
4 files changed
+135
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
106 | 125 | | |
107 | 126 | | |
108 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
753 | 754 | | |
754 | 755 | | |
755 | 756 | | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
756 | 761 | | |
757 | 762 | | |
758 | 763 | | |
| |||
1010 | 1015 | | |
1011 | 1016 | | |
1012 | 1017 | | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
1013 | 1025 | | |
1014 | 1026 | | |
1015 | 1027 | | |
| |||
1634 | 1646 | | |
1635 | 1647 | | |
1636 | 1648 | | |
| 1649 | + | |
1637 | 1650 | | |
1638 | 1651 | | |
1639 | 1652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| |||
2342 | 2346 | | |
2343 | 2347 | | |
2344 | 2348 | | |
2345 | | - | |
| 2349 | + | |
| 2350 | + | |
2346 | 2351 | | |
2347 | 2352 | | |
2348 | 2353 | | |
| |||
2352 | 2357 | | |
2353 | 2358 | | |
2354 | 2359 | | |
2355 | | - | |
2356 | | - | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
2357 | 2363 | | |
2358 | | - | |
| 2364 | + | |
| 2365 | + | |
2359 | 2366 | | |
2360 | 2367 | | |
2361 | 2368 | | |
| |||
2372 | 2379 | | |
2373 | 2380 | | |
2374 | 2381 | | |
2375 | | - | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
2376 | 2395 | | |
2377 | | - | |
2378 | | - | |
2379 | | - | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
2380 | 2403 | | |
2381 | 2404 | | |
2382 | 2405 | | |
| |||
2762 | 2785 | | |
2763 | 2786 | | |
2764 | 2787 | | |
2765 | | - | |
| 2788 | + | |
| 2789 | + | |
2766 | 2790 | | |
2767 | | - | |
| 2791 | + | |
2768 | 2792 | | |
2769 | 2793 | | |
2770 | 2794 | | |
| |||
2876 | 2900 | | |
2877 | 2901 | | |
2878 | 2902 | | |
| 2903 | + | |
2879 | 2904 | | |
2880 | 2905 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
725 | 793 | | |
726 | 794 | | |
727 | 795 | | |
| |||
0 commit comments