]> Kevux Git Server - rit/commit
path-walk: support wildcard pathspecs for blob filtering
authorDerrick Stolee <stolee@gmail.com>
Thu, 26 Mar 2026 15:14:53 +0000 (15:14 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Mar 2026 16:38:07 +0000 (09:38 -0700)
commit3f20c21a1ceeb796e121147a53ba10d28041b1fe
tree998e84a94c0d1480e6be6a4cbb0f336b8cdecf3d
parent7be182045a6a113b118982fc81296d5b9746779e
path-walk: support wildcard pathspecs for blob filtering

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 two 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. 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 <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path-walk.c
t/t5620-backfill.sh