{"record":{"id":"ec1d22731dd22a9a","repo":"pestphp/pest","slug":"the-filter-by-dirty-files-feature-requires-git","errorCode":null,"errorMessage":"The [Filter by dirty files] feature requires [git]. Please install it and try again.","messagePattern":"The \\[Filter by dirty files\\] feature requires \\[git\\]\\. Please install it and try again\\.","errorType":"exception","errorClass":"MissingDependency","httpStatus":null,"severity":"error","filePath":"src/TestCaseFilters/GitDirtyTestCaseFilter.php","lineNumber":52,"sourceCode":"\n        assert(is_array($this->changedFiles));\n\n        $relativePath = str_replace($this->projectRoot, '', $testCaseFilename);\n        $relativePath = str_replace(DIRECTORY_SEPARATOR, '/', $relativePath);\n\n        if (str_starts_with($relativePath, '/')) {\n            $relativePath = substr($relativePath, 1);\n        }\n\n        return in_array($relativePath, $this->changedFiles, true);\n    }\n\n    private function loadChangedFiles(): void\n    {\n        $status = new Git(timeout: 60.0)->raw(['status', '--short', '--', '*.php']);\n\n        if ($status === null) {\n            throw new MissingDependency('Filter by dirty files', 'git');\n        }\n\n        $output = preg_split('/\\R+/', $status, flags: PREG_SPLIT_NO_EMPTY);\n        assert(is_array($output));\n\n        $dirtyFiles = [];\n\n        foreach ($output as $dirtyFile) {\n            $dirtyFiles[substr($dirtyFile, 3)] = trim(substr($dirtyFile, 0, 3));\n        }\n\n        $dirtyFiles = array_filter($dirtyFiles, fn (string $status): bool => $status !== 'D');\n\n        $dirtyFiles = array_map(\n            fn (string $file, string $status): string => in_array($status, ['R', 'RM'], true)\n                ? explode(' -> ', $file)[1]\n                : $file, array_keys($dirtyFiles), $dirtyFiles,\n        );","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/pestphp/pest/blob/1af74a215c3a89bc7a44fc6f9322e369eaad2423/src/TestCaseFilters/GitDirtyTestCaseFilter.php#L34-L70","documentation":"Error \"The [Filter by dirty files] feature requires [git]. Please install it and try again.\" thrown in pestphp/pest.","triggerScenarios":"Thrown at src/TestCaseFilters/GitDirtyTestCaseFilter.php:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1af74a215c3a89bc7a44fc6f9322e369eaad2423","analyzedAt":"2026-08-21T02:16:38.132Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}