All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Johannes.Schindelin@gmx.de,
	 Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH] fsmonitor: invalidate untracked cache after losing history
Date: Wed, 04 Nov 2026 14:52:16 -0800	[thread overview]
Message-ID: <xmqqmrroyztr.fsf@gitster.g> (raw)
In-Reply-To: <pull.2295.git.1793806679163.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Wed, 04 Nov 2026 15:37:59 +0000")

"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Derrick Stolee <stolee@gmail.com>
>
> When fsmonitor fails or returns a trivial response, refresh_fsmonitor()
> clears CE_FSMONITOR_VALID and disables fsmonitor use for the untracked
> cache. Unfortunately, this may leave untracked cache entries marked
> 'valid' so future commands may miss necessary updates.
>
> A command such as 'git update-index --refresh' can save the replacement
> fsmonitor token without scanning untracked directories. If the next
> query returns no changes, fsmonitor use is enabled again and 'git status'
> trusts directory contents cached before the loss of event history. New
> untracked files can remain invisible.
>
> This integration bug between fsmonitor and the untracked cache has
> existed since the fsmonitor feature was introduced in 883e248b8a0
> (fsmonitor: teach git to optionally utilize a file system monitor to
> speed up detecting new or changed files., 2017-09-22).
>
> To fix the problem, react more completely on a failed fsmonitor token
> request. In this case, invalidate every untracked cache directory and
> mark the untracked extension as changed. To guarantee that the index is
> updatede, set UNTRACKED_CHANGED so that the index is written even when
> no tracked entry changes. Keep the directory nodes intact to preserve
> pointers held by callers.
> ...
>     fsmonitor: invalidate untracked cache after losing history
>     
>     A user of an internal monorepo reported this behavior, including an
>     AI-assisted powershell script to prove how it worked. I used an agent to
>     assist in porting that to a Git test script and a code fix, but then
>     applied significant human editing and validation on top to get it up to
>     my standards.
>     
>     Thanks, -Stolee

Would this be a viable replacement for ik/fsmonitor-untracked-cache-trivial-response

  https://lore.kernel.org/git/pull.2247.git.1791127155614.gitgitgadget@gmail.com/

that has been left unreviewed for a month?

  parent reply	other threads:[~2026-11-04 22:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 15:37 [PATCH] fsmonitor: invalidate untracked cache after losing history Derrick Stolee via GitGitGadget
2026-11-04 20:39 ` Junio C Hamano
2026-11-04 22:52 ` Junio C Hamano [this message]
2026-11-05 14:08   ` Derrick Stolee
2026-11-05 15:02     ` Derrick Stolee
2026-11-05 17:39     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqmrroyztr.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.