Subject: Re: [PATCH 4/5] backfill: work with prefix pathspecs

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 19 Mar 2026 10:55:12 +0100

On Tue, Mar 17, 2026 at 12:29:20AM +0000, Derrick Stolee via GitGitGadget wrote:
> diff --git a/path-walk.c b/path-walk.c
> index 364e4cfa19..e1ad4b0208 100644
> --- a/path-walk.c
> +++ b/path-walk.c
> @@ -481,6 +524,18 @@ int walk_objects_by_path(struct path_walk_info *info)
>  	if (info->tags)
>  		info->revs->tag_objects = 1;
>  
> +	if (ctx.revs->prune_data.nr) {
> +		/*
> +		 * Only exact prefix pathspecs are currently supported.
> +		 * Clear any wildcard or magic pathspecs to avoid
> +		 * incorrect prefix matching.
> +		 */
> +		struct pathspec *pd = &ctx.revs->prune_data;
> +
> +		if (pd->has_wildcard || pd->magic)
> +			pd->nr = 0;
> +	}

Huh, curious. Won't this cause a leak? I guess we should rather use
`clear_pathspec()` here.

Also shows that this path is missing test coverage.

Patrick