name-hash: use expand_to_path()
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 12 Apr 2021 21:08:17 +0000 (21:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:48:01 +0000 (13:48 -0700)
commit4589bca829a2ace58bc98876cccd7dbd2e89f732
treede51de02e3730e05b8689e64519db60b5374806b
parent71f82d032f34f7aa3708b4cdaeb12db617449606
name-hash: use expand_to_path()

A sparse-index loads the name-hash data for its entries, including the
sparse-directory entries. If a caller asks for a path that is contained
within a sparse-directory entry, we need to expand to a full index and
recalculate the name hash table before returning the result. Insert
calls to expand_to_path() to protect against this case.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
name-hash.c