Re: [PATCH v3 03/14] dir: extract directory-matching logic
On 9/22/2021 7:13 PM, Junio C Hamano wrote:
Show 25 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> +static int path_matches_dir_pattern(const char *pathname,
>> + int pathlen,
>> + int *dtype,
>> + struct path_pattern *pattern,
>> + struct index_state *istate)
>> +{
>> + *dtype = resolve_dtype(*dtype, istate, pathname, pathlen);
>> + if (*dtype != DT_DIR)
>> + return 0;
>> +
>> + return 1;
>> +}
>
> The function name and parameter list have "pattern" but as far as I
> can see any "matches" or "pattern" comes into the picture. The code
> in the caller after calling this function may be doing pattern
> matching, but not this one.
>
> What this helper is doing is "signal if the pathname in the working
> tree is supposed to be a directory with the return value, while
> filling *dtype with what kind of thing it is."
>
> path_must_be_dir_in_working_tree() or something, perhaps?Yes, a rename would be prudent here. Thanks.
-Stolee