From: Junio C Hamano Date: Tue, 17 Mar 2026 22:19:00 GMT Subject: Re: [PATCH 5/5] path-walk: support wildcard pathspecs for blob filtering Message-ID: In-Reply-To: "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 ? > 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? > --- > path-walk.c | 22 ++++++++++++++-------- > t/t5620-backfill.sh | 7 +++---- > 2 files changed, 17 insertions(+), 12 deletions(-)