microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.16k stars 28.84k forks source link

Git: File watcher events should respect `.gitignore` #101519

Open aktary opened 4 years ago

aktary commented 4 years ago

Version: 1.46.1 Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d Date: 2020-06-17T21:17:14.222Z Electron: 7.3.1 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.5.0 Steps to Reproduce:

  1. This is an exact regression of https://github.com/Microsoft/vscode/issues/33309. All of the details filed there are found the bug I just experienced. I'm unable to reopen that bug, so filing a new one here.
  2. The only way I've found to stop the repeated polling of git is to remove the additional workspace root(s) and only have one.

Does this issue occur when all extensions are disabled?: Yes

aktary commented 4 years ago

... I take it back. Removing the additional workspace root didn't stop it for good. Once I opened a new file, it started repeatedly polling again :(

The only way to make this stop is turning off git.autorefresh.

joaomoreno commented 4 years ago
  1. Run Git: Set Log Level... and choose Trace
  2. Run Git: Show Git Output
  3. Reproduce the issue and wait 10-20 seconds
  4. Paste the whole output here

Thanks!

aktary commented 4 years ago

Oooookay.... so...based on the below output, it's clear that the database temp files are triggering the re-poll. However our setup is thus:

Monorepo Root <-- Is a workspace and contains the .gitignore that ignores `psql`
| - packages
    | - components  <-- secondary folder opened 
| - projects
    | - discovery  <--primary workspace where VSCode is opened
        |- postgres
            | - psql
        | - client
        | - server

Since I'm working in a subdirectory of the monorepo, shouldn't it honor the .gitignore in the root and ignore the tmp file updates in psql?

Also, it's worth noting that I created a .gitignore in the discovery directory ignoring the psql directory and it had no effect.

git status -z -u git symbolic-ref --short HEAD git rev-parse david/accounts-dashboard git rev-parse --symbolic-full-name david/accounts-dashboard@{u} git rev-list --left-right david/accounts-dashboard...refs/remotes/origin/david/accounts-dashboard git for-each-ref --format %(refname) %(objectname) --sort -committerdate git remote --verbose git config --get commit.template git show :projects/discovery/client/src/app/dashboard/view-daily-balance-table.tsx git ls-files --stage -- /Users/davidaktary/Projects/singularity/projects/discovery/client/src/app/dashboard/view-daily-balance-table.tsx git cat-file -s d948425a510ca60996ac34b132888ecda9005d66 [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_32769.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_32769.tmp git status -z -u git symbolic-ref --short HEAD git rev-parse david/accounts-dashboard git rev-parse --symbolic-full-name david/accounts-dashboard@{u} git rev-list --left-right david/accounts-dashboard...refs/remotes/origin/david/accounts-dashboard git for-each-ref --format %(refname) %(objectname) --sort -committerdate git remote --verbose git config --get commit.template git show :projects/discovery/client/src/app/dashboard/line-chart.tsx git ls-files --stage -- /Users/davidaktary/Projects/singularity/projects/discovery/client/src/app/dashboard/line-chart.tsx git show :projects/discovery/client/src/app/dashboard/view-daily-balance-table.tsx git ls-files --stage -- /Users/davidaktary/Projects/singularity/projects/discovery/client/src/app/dashboard/view-daily-balance-table.tsx git cat-file -s d948425a510ca60996ac34b132888ecda9005d66 [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_16490.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_16490.tmp git status -z -u git symbolic-ref --short HEAD git rev-parse david/accounts-dashboard git rev-parse --symbolic-full-name david/accounts-dashboard@{u} git rev-list --left-right david/accounts-dashboard...refs/remotes/origin/david/accounts-dashboard git for-each-ref --format %(refname) %(objectname) --sort -committerdate git remote --verbose git config --get commit.template [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_32769.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.stat [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_0.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/global.tmp [debug] [wt] Change: /Users/davidaktary/Projects/singularity/projects/discovery/postgres/psql/data/pg_stat_tmp/db_32769.tmp git status -z -u git symbolic-ref --short HEAD git rev-parse david/accounts-dashboard git rev-parse --symbolic-full-name david/accounts-dashboard@{u} git rev-list --left-right david/accounts-dashboard...refs/remotes/origin/david/accounts-dashboard git for-each-ref --format %(refname) %(objectname) --sort -committerdate git remote --verbose git config --get commit.template

joaomoreno commented 4 years ago

The file watcher actually disregards .gitignore, but maybe it shouldn't. 🤔

Though I would simply do an implementation in which only the top level .gitignore file is respected, out of performance reasons.

aktary commented 3 years ago

Any updates here?

guw commented 1 year ago

FWIW, this seems to be an issue with large Git repos using Bazel as well because Bazel creates bazel-* symlinks, which link to build area with lots of additional outputs. They are usually in .gitignore.