Re: [PATCH 5/5] path-walk: support wildcard pathspecs for blob filtering
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 23, 2026, 01:33 UTC
- Message-ID
- <bf0cc84b-b4ea-4100-87b6-d29777155037@gmail.com>
- In-Reply-To
- <443e5b25-46a1-4990-96b3-122e66d81828@gmail.com>
On 3/18/26 9:16 AM, Derrick Stolee wrote:
Show 33 quoted lines
> On 3/17/2026 6:19 PM, Junio C Hamano wrote: >> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes: >> >>> From: Derrick Stolee <stolee@gmail.com> >>> >>> Previously, walk_objects_by_path() silently ignored pathspecs containing >>> wildcards or magic by clearing them. This caused all blobs to be >>> downloaded regardless of the given pathspec. Wildcard pathspecs like >>> "d/file.*.txt" are useful for narrowing which blobs to process (e.g., >>> during 'git backfill'). >>> >>> Support wildcard pathspecs by making three changes: >>> >>> 1. Add an 'exact_pathspecs' flag to path_walk_context. When the >>> pathspec has no wildcards or magic, set this flag and use the >>> existing fast-path prefix matching in add_tree_entries(). When >>> wildcards are present, skip that block since prefix matching >>> cannot handle glob patterns. >>> >>> 2. Disable revision-level commit pruning (revs->prune = 0) for >>> wildcard pathspecs. The revision walk uses the pathspec to filter >>> commits via TREESAME detection. For exact prefix pathspecs this >>> works well, but wildcard pathspecs may fail to match through >>> TREESAME because fnmatch with WM_PATHNAME does not cross directory >>> boundaries. Disabling pruning ensures all commits are visited and >>> their trees are available for the path-walk to filter. >> >> Hmph, I wonder how significant an impact does it have on the >> performance that we have to disable pruning here. With the bog >> standard tree traversal, wouldn't tree_entry_interesting() already >> be capable of doing this, even with fnmatch / WM_PATHNAME ? > > I will explore what's possible here and see what I can do.
I must have needed the 'revs->prune = 0' at some point during development and left it even though it isn't actually necessary. Leaving it implicitly at '1' should indeed be faster due to traversing fewer commits and parsing fewer trees while still reaching all necessary blobs.
Only changes 1 and 3 are necessary.
Thanks, -Stolee