diff --git a/crates/vite_task/src/execute.rs b/crates/vite_task/src/execute.rs index 216d339519..0b6a1a54ee 100644 --- a/crates/vite_task/src/execute.rs +++ b/crates/vite_task/src/execute.rs @@ -394,6 +394,10 @@ pub async fn execute_task( // ignore accesses outside the workspace continue; }; + if relative_path.as_path().strip_prefix(".git").is_ok() { + // temp workaround for oxlint reading inside .git + continue; + } match access.mode { AccessMode::Read => { path_reads.entry(relative_path).or_insert(PathRead { read_dir_entries: false }); diff --git a/packages/cli/tests/cases/lint-dot-git/package.json b/packages/cli/tests/cases/lint-dot-git/package.json new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/packages/cli/tests/cases/lint-dot-git/package.json @@ -0,0 +1,2 @@ +{ +} diff --git a/packages/cli/tests/cases/lint-dot-git/snap.txt b/packages/cli/tests/cases/lint-dot-git/snap.txt new file mode 100644 index 0000000000..55f6c214ab --- /dev/null +++ b/packages/cli/tests/cases/lint-dot-git/snap.txt @@ -0,0 +1,13 @@ +> mkdir .git + +> vite-plus lint +Cache not found +Found 0 warnings and 0 errors. +Finished in ms on 0 files with rules using threads. + +> echo hello > .git/foo.txt + +> vite-plus lint # changes inside .git should not invalidate cache +Cache hit, replaying +Found 0 warnings and 0 errors. +Finished in ms on 0 files with rules using threads. diff --git a/packages/cli/tests/cases/lint-dot-git/steps.json b/packages/cli/tests/cases/lint-dot-git/steps.json new file mode 100644 index 0000000000..71e3064fce --- /dev/null +++ b/packages/cli/tests/cases/lint-dot-git/steps.json @@ -0,0 +1,11 @@ +{ + "env": { + "VITE_DISABLE_AUTO_INSTALL": "1" + }, + "commands": [ + "mkdir .git", + "vite-plus lint", + "echo hello > .git/foo.txt", + "vite-plus lint # changes inside .git should not invalidate cache" + ] +}