fsmonitor: support case-insensitive events
commit29c139ce7895e1c14be119300a7f99fbdc90c5e1
authorJeff Hostetler <jeffhostetler@github.com>
Mon, 26 Feb 2024 21:39:25 +0000 (26 21:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Mar 2024 17:10:06 +0000 (6 09:10 -0800)
treeda34e706fcac4cde4a0ad8e6b102781433457ffc
parentb0dba507fe3bb12836100f44e2fcfdf69091fd4d
fsmonitor: support case-insensitive events

Teach fsmonitor_refresh_callback() to handle case-insensitive
lookups if case-sensitive lookups fail on case-insensitive systems.
This can cause 'git status' to report stale status for files if there
are case issues/errors in the worktree.

The FSMonitor daemon sends FSEvents using the observed spelling
of each pathname.  On case-insensitive file systems this may be
different than the expected case spelling.

The existing code uses index_name_pos() to find the cache-entry for
the pathname in the FSEvent and clear the CE_FSMONITOR_VALID bit so
that the worktree scan/index refresh will revisit and revalidate the
path.

On a case-insensitive file system, the exact match lookup may fail
to find the associated cache-entry. This causes status to think that
the cached CE flags are correct and skip over the file.

Update event handling to optionally use the name-hash and dir-name-hash
if necessary.

Also update t7527 to convert the "test_expect_failure" to "_success"
now that we have fixed the bug.

Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsmonitor.c
t/t7527-builtin-fsmonitor.sh