From: Derrick Stolee <stolee@gmail.com>
To: Philip Oakley <philipoakley@iee.email>,
Drew Noakes <drew@drewnoakes.com>,
git@vger.kernel.org, Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: Detecting when bulk file-system operations complete
Date: Thu, 1 Apr 2021 09:10:55 -0400 [thread overview]
Message-ID: <9c09459b-2d27-6997-63c1-46c8df52eda7@gmail.com> (raw)
In-Reply-To: <5a1abc6b-52a3-fc12-166f-8af5e7bdff48@iee.email>
On 3/31/2021 12:03 PM, Philip Oakley wrote:
> Hi Drew,
>
> On 31/03/2021 04:39, Drew Noakes wrote:
>> Hi,
>>
>> I develop IDE tooling that watches a repo's workspace and reacts to changes.
>>
>> Bulk file-system changes (i.e. branch switch, rebase, merge,
>> cherry-pick) trigger lots of file system events, and my tooling should
>> ignore intermediary updates. Currently I debounce events with a fixed
>> time span, but would like a more reliable and performant approach to
>> scheduling this reactive work.
>>
>> Can this be done by monitoring the GITDIR in some way? For example, is
>> there a file that's present when these operations are in flight, and
>> which is removed when they complete?
>>
>> If an operation is interrupted (i.e. merge or rebase that hits a
>> conflict) my tooling should consider the bulk operation as complete.
>> This means that detecting a git-rebase-todo file or
>> rebase-merge/rebase-apply folder is not adequate.
>>
>> Any help appreciated. Thanks!
>>
>> Drew.
> You may want to look at the various bits of work on `fsmonitor` etc on
> the mailing list archive
>
> https://lore.kernel.org/git/?q=fsmonitor
>
> to ensure that all the different approaches inter-operate with
> reasonable efficiency..
This is an important suggestion. There is an issue with the current
approach of using FS Monitor with Watchman along with Visual Studio
Code and certain Git plugins:
1. When "git status" runs, the FS Monitor hook asks Watchman for
changes. Watchman puts a "cookie file" in the working directory
so it knows when the file system events are flushed.
2. VS Code notices this cookie file was written, so it interprets
that a file was changed in the working directory. It calls
"git status" to update its markers on the modified files.
This loops forever.
The new version of FS Monitor that Jeff Hostetler is working on
writes the cookie file into the .git directory, which VS Code (and
hopefully other IDEs) do not consider a trigger for running commands
like "git status".
This is just one example of the trickiness that ensues when using
filesystem events.
Thanks,
-Stolee
next prev parent reply other threads:[~2021-04-01 17:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 3:39 Detecting when bulk file-system operations complete Drew Noakes
2021-03-31 16:03 ` Philip Oakley
2021-04-01 13:10 ` Derrick Stolee [this message]
2021-04-02 15:02 ` Jeff Hostetler
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=9c09459b-2d27-6997-63c1-46c8df52eda7@gmail.com \
--to=stolee@gmail.com \
--cc=drew@drewnoakes.com \
--cc=git@vger.kernel.org \
--cc=jeffhost@microsoft.com \
--cc=philipoakley@iee.email \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).