From: Derrick Stolee Date: Wed, 18 Mar 2026 13:16:14 GMT Subject: Re: [PATCH 5/5] path-walk: support wildcard pathspecs for blob filtering Message-ID: <443e5b25-46a1-4990-96b3-122e66d81828@gmail.com> In-Reply-To: On 3/17/2026 6:19 PM, Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" writes: > >> From: Derrick Stolee >> >> 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. >> 3. Add a match_pathspec() check in walk_path() to filter out blobs >> whose full path does not match the pathspec. This provides the >> actual blob-level filtering for wildcard pathspecs. >> >> Signed-off-by: Derrick Stolee >> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> > > The latter person cannot sign DCO or vouch for the origin of what > they have written in this patch, can they? No they cannot. Sorry for this error. Thanks, -Stolee