Change:
Type: <bBug</bI cloned my repo by clicking Clone Repositary button in the Source Control tab. However by just leaving my cursor focus on my file, the Source Control tab auto refreshes every 5 seconds. You can see the Git Output: Turn off git.autorefresh can "solve" this issue. Is this a normal behavior? Why would vscode auto refreshs in such a short time? There's no such issue with my another repositary which is very simple. I see that another user also report this . I think this issue or feature is included in 1.75.1. I tried 1.74.3 and 1.68.1, they don't have such issue. VS Code version: Code 1.76.2 (, 2023-03-14T17:55:54.936Z) OS version: WindowsNT x64 10.0. Modes: Sandboxed: No <details<summarySystem Info</summary </detailsExtensions: none<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
that does not sound like normal behaviour. Could you please execute the "Developer: Set Log Level..." command from the command palette, select "Git" from the extension list, and pick "Trace". Reproduce the issue, and then share the contents of the git output window. Thanks!
Hi Szomoru, You can see the trace below:
thank you! I will investigate the issue and get back to you.
I am seeing the same thing -- every 5 seconds the Git extension runs: I haven't found what triggers this -- my guess is that I have Git setup with file watching and maybe the Git extension is seeing that cache get updated (but its still odd that it would happen every 5s). In GitLens, I crafted my file watchers (wish we had excludes), to avoid detecting changes in the folder, since that is what Git updates. Also, this reproduces for me with and without GitLens (so there isn't some odd interaction there).
could you please enable logging for the git extension: the "Developer: Set Log Level..." command from the command palette "Git" from the list of extensions, and then "Trace" the contents of the git output window
here you go, and it proves that it is the Git file watcher, as is where it stores that state
If it helps any, I crafted the file watchers in GitLens to only watch specific parts of the folder that I needed:
I have looked into this and found out that this is a Windows specific problem and one can easily reproduce by enabling logging for the Git extension, making a change to a file, and then staging the file. In the Git output channel one can notice a extra file system event with the prefix that should have been filtered out but it is not. The problem is this regular expression that uses but not :
<!-- AUTHORVERIFICATIONREQUEST --This bug has been fixed in the latest release of ! you can help us out by commenting if things are now working as expected. If things still don't seem right, please ensure you're on version of Insiders (today's or later - you can use in the command palette to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
could you please confirm that this is fixed in the latest Insiders release? Thanks!
Looks good! Thanks!
So is it just a case where using node's would solve the problem?

Discussion:
this.disposables.push(repositoryWatcher); const onRepositoryFileChange = anyEvent(repositoryWatcher.onDidChange, repositoryWatcher.onDidCreate, repositoryWatcher.onDidDelete); <del> const onRepositoryWorkingTreeFileChange = filterEvent(onRepositoryFileChange, uri => !/.git($|/)/.test(relativePath(repository.root, uri.fsPath))); </del> <ins> const onRepositoryWorkingTreeFileChange = filterEvent(onRepositoryFileChange, uri => !/.git($||/)/.test(relativePath(repository.root, uri.fsPath))); </ins> let onRepositoryDotGitFileChange: Event<Uri>;

} catch (err) { logger.error(`Failed to watch path:'${this.dotGit.path}' or commonPath:'${this.dotGit.commonPath}', reverting to legacy API file watched. Some events might be lost.n${err.stack || err}`); <del> onRepositoryDotGitFileChange = filterEvent(onRepositoryFileChange, uri => /.git($|/)/.test(uri.path)); </del> <ins> onRepositoryDotGitFileChange = filterEvent(onRepositoryFileChange, uri => /.git($||/)/.test(uri.path)); </ins> } // FS changes should trigger `git status`: