Repository: vscode
Issue: Git status is triggering far too often on a large repo (during build)
Labels: git,under-discussion,performance

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: N/A

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.94.2
- OS Version: Windows 10

I noticed Git goes crazy whenever I build Chromium. It shouldn't be because I'm not running any Git-related tasks while this is happening, it takes up a lot of CPU. I noticed this older issue: https://github.com/microsoft/vscode/issues/177773

I follow the same steps mentioned [here](https://github.com/microsoft/vscode/issues/177773#issuecomment-1540804701) and looked at the trace output. 
It looks like every time the build generates a new file in the `out` directory it triggers the git extension to [run `git status`](https://github.com/microsoft/vscode/blob/5237e49bc1bddc2eee28609c8b457b9983f6470b/extensions/git/src/repository.ts#L879-L883) again. I *think* I've managed to calm it down a bit by setting `"git.autorefresh": false,`, you can see the output below.

Output:
```
2024-10-11 19:35:37.122 [debug] [FileEventLogger][onWorkspaceWorkingTreeFileChange] C:\chromium\out\obj\third_party\blink\renderer\core\testing\sequence_test-bcfbf884.obj.tmp
2024-10-11 19:35:37.601 [trace] [Repository][onFileChange] Skip running git status because autorefresh setting is disabled.
2024-10-11 19:35:37.601 [debug] [FileEventLogger][onWorkspaceWorkingTreeFileChange] C:\chromium\out\obj\third_party\blink\renderer\core\testing\null_execution_context-fd483ba5.obj.tmp
2024-10-11 19:35:38.001 [trace] [Repository][onFileChange] Skip running git status because autorefresh setting is disabled.
2024-10-11 19:35:38.001 [debug] [FileEventLogger][onWorkspaceWorkingTreeFileChange] C:\chromium\out\obj\third_party\blink\renderer\core\core_hot\selector_query.obj
2024-10-11 19:35:38.001 [trace] [Repository][onFileChange] Skip running git status because autorefresh setting is disabled.
2024-10-11 19:35:38.001 [debug] [FileEventLogger][onWorkspaceWorkingTreeFileChange] C:\chromium\out\obj\third_party\blink\renderer\core\core_hot\selector_query-0130c7b5.obj.tmp
2024-10-11 19:35:38.635 [trace] [Repository][onFileChange] Skip running git status because autorefresh setting is disabled.
thousands more...
```

Despite it skipping this still looks like a bug, the `out` directory is in my gitignore so it shouldn't be doing anything on changes within this directory at all anyway. Should there be logic added to [here](https://github.com/microsoft/vscode/blob/5237e49bc1bddc2eee28609c8b457b9983f6470b/extensions/git/src/repository.ts#L879-L883) to not trigger git commands if the file changes are in an ignored repository?

Using `autorefresh false` is a workaround to the problem but not a proper solution as I do want git to update when genuine files have changed. Maybe either the git extension should be fixed, or the built-in workspace watcher has a config to not watch ignored folders.

Steps to Reproduce:

1. Load Chromium in VS Code
2. Build Chromium
3. Git activity goes super high in task manager (parent process being VS Code)