Re: [PATCH 2/2] unpack-trees: use traverse_path instead of name
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Dec 6, 2021, 13:59 UTC
- Message-ID
- <166c107e-1884-ca53-fa46-12b39e6af13f@gmail.com>
- In-Reply-To
- <CABPp-BEs8_F7SKsxDMd8p03oMn9M3H47=hrPP=AzxsacUkGg_A@mail.gmail.com>
On 12/4/2021 12:42 AM, Elijah Newren wrote:
> On Fri, Dec 3, 2021 at 6:55 PM Derrick Stolee via GitGitGadget > <gitgitgadget@gmail.com> wrote:
Show 21 quoted lines
>> @@ -1243,11 +1243,11 @@ static int sparse_dir_matches_path(const struct cache_entry *ce, >> assert(S_ISSPARSEDIR(ce->ce_mode)); >> assert(ce->name[ce->ce_namelen - 1] == '/'); >> >> - if (info->namelen) >> - return ce->ce_namelen == info->namelen + p->pathlen + 2 && >> - ce->name[info->namelen] == '/' && >> - !strncmp(ce->name, info->name, info->namelen) && >> - !strncmp(ce->name + info->namelen + 1, p->path, p->pathlen); >> + if (info->pathlen) >> + return ce->ce_namelen == info->pathlen + p->pathlen + 1 && >> + ce->name[info->pathlen - 1] == '/' && >> + !strncmp(ce->name, info->traverse_path, info->pathlen) && >> + !strncmp(ce->name + info->pathlen, p->path, p->pathlen); >> return ce->ce_namelen == p->pathlen + 1 && >> !strncmp(ce->name, p->path, p->pathlen); >> } >> -- > > The comment at the beginning of this function (not shown in this > patch) is now stale and misleading; it should be corrected too.
Will do! Thanks for catching that.
Thanks, -Stolee