<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fsmonitor.c, branch v2.46.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.46.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.46.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-03-06T17:10:06Z</updated>
<entry>
<title>fsmonitor: support case-insensitive events</title>
<updated>2024-03-06T17:10:06Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29c139ce7895e1c14be119300a7f99fbdc90c5e1'/>
<id>urn:sha1:29c139ce7895e1c14be119300a7f99fbdc90c5e1</id>
<content type='text'>
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 &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: refactor bit invalidation in refresh callback</title>
<updated>2024-03-06T17:10:06Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b0dba507fe3bb12836100f44e2fcfdf69091fd4d'/>
<id>urn:sha1:b0dba507fe3bb12836100f44e2fcfdf69091fd4d</id>
<content type='text'>
Refactor code in the fsmonitor_refresh_callback() call chain dealing
with invalidating the CE_FSMONITOR_VALID bit and add a trace message.

During the refresh, we clear the CE_FSMONITOR_VALID bit in response to
data from the FSMonitor daemon (so that a later phase will lstat() and
verify the true state of the file).

Create a new function to clear the bit and add some unique tracing for
it to help debug edge cases.

This is similar to the existing `mark_fsmonitor_invalid()` function,
but it also does untracked-cache invalidation and we've already
handled that in the refresh-callback handlers, so but we don't need
to repeat that.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: trace the new invalidated cache-entry count</title>
<updated>2024-03-06T17:10:06Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=84d441f2f09d2974aac75ba93ff3a562d7d31469'/>
<id>urn:sha1:84d441f2f09d2974aac75ba93ff3a562d7d31469</id>
<content type='text'>
Consolidate the directory/non-directory calls to the refresh handler
code.  Log the resulting count of invalidated cache-entries.

The nr_in_cone value will be used in a later commit to decide if
we also need to try to do case-insensitive lookups.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: return invalidated cache-entry count on non-directory event</title>
<updated>2024-03-06T17:10:00Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9e34e562805986b1ed0d1518a5822b9ec495960b'/>
<id>urn:sha1:9e34e562805986b1ed0d1518a5822b9ec495960b</id>
<content type='text'>
Teach the refresh callback helper function for unqualified FSEvents
(pathnames without a trailing slash) to return the number of
cache-entries that were invalided in response to the event.

This will be used in a later commit to help determine if the observed
pathname was (possibly) case-incorrect when (on a case-insensitive
file system).

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: remove custom loop from non-directory path handler</title>
<updated>2024-02-26T23:34:03Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=558d146d13e2632aa9cd580cbfb81fbf635c3566'/>
<id>urn:sha1:558d146d13e2632aa9cd580cbfb81fbf635c3566</id>
<content type='text'>
Refactor the code that handles refresh events for pathnames that do
not contain a trailing slash.  Instead of using a custom loop to try
to scan the index and detect if the FSEvent named a file or might be a
directory prefix, use the recently created helper function to do that.

Also update the comments to describe what and why we are doing this.

On platforms that DO NOT annotate FS events with a trailing
slash, if we fail to find an exact match for the pathname
in the index, we do not know if the pathname represents a
directory or simply an untracked file.  Pretend that the pathname
is a directory and try again before assuming it is an untracked
file.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: return invalidated cache-entry count on directory event</title>
<updated>2024-02-26T23:34:03Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a52482036cde8d2cd779039a70162fda9bd1c29a'/>
<id>urn:sha1:a52482036cde8d2cd779039a70162fda9bd1c29a</id>
<content type='text'>
Teach the refresh callback helper function for directory FSEvents to
return the number of cache-entries that were invalidated in response
to a directory event.

This will be used in a later commit to help determine if the observed
pathname in the FSEvent was a (possibly) case-incorrect directory
prefix (on a case-insensitive filesystem) of one or more actual
cache-entries.

If there exists at least one case-insensitive prefix match, then we
can assume that the directory is a (case-incorrect) prefix of at least
one tracked item rather than a completely unknown/untracked file or
directory.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: move untracked-cache invalidation into helper functions</title>
<updated>2024-02-26T23:34:02Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c97174dcd6d0f5327cc9b9ddf171ba1d9bba91c'/>
<id>urn:sha1:7c97174dcd6d0f5327cc9b9ddf171ba1d9bba91c</id>
<content type='text'>
Move the call to invalidate the untracked-cache for the FSEvent
pathname into the two helper functions.

In a later commit in this series, we will call these helpers
from other contexts and it safer to include the UC invalidation
in the helpers than to remember to also add it to each helper
call-site.

This has the side-effect of invalidating the UC *before* we
invalidate the ce_flags in the cache-entry.  These activities
are independent and do not affect each other.  Also, by doing
the UC work first, we can avoid worrying about "early returns"
or the need for the usual "goto the end" in each of the
handler functions.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: refactor untracked-cache invalidation</title>
<updated>2024-02-26T23:34:02Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48f4cd7155a117b964e446f5c954d1046f2038c0'/>
<id>urn:sha1:48f4cd7155a117b964e446f5c954d1046f2038c0</id>
<content type='text'>
Update fsmonitor_refresh_callback() to use the new
untracked_cache_invalidate_trimmed_path() to invalidate
the cache using the observed pathname without needing to
modify the caller's buffer.

Previously, we modified the caller's buffer when the observed pathname
contained a trailing slash (and did not restore it).  This wasn't a
problem for the single use-case caller, but felt dirty nontheless.  In
a later commit we will want to invalidate case-corrected versions of
the pathname (using possibly borrowed pathnames from the name-hash or
dir-name-hash) and we may not want to keep the tradition of altering
the passed-in pathname.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: refactor refresh callback for non-directory events</title>
<updated>2024-02-26T23:34:02Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8687c2b067a89e0c91a65b46b4f5eccf041e6718'/>
<id>urn:sha1:8687c2b067a89e0c91a65b46b4f5eccf041e6718</id>
<content type='text'>
Move the code that handles unqualified FSEvents (without a trailing
slash) into a helper function.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: clarify handling of directory events in callback helper</title>
<updated>2024-02-26T23:34:02Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhostetler@github.com</email>
</author>
<published>2024-02-26T21:39:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a15a62aebdf1f5aac2f74de67585908191c3bc4'/>
<id>urn:sha1:7a15a62aebdf1f5aac2f74de67585908191c3bc4</id>
<content type='text'>
Improve documentation of the refresh callback helper function
used for directory FSEvents.

Signed-off-by: Jeff Hostetler &lt;jeffhostetler@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
