Cache git dirty files by shitikanth · Pull Request #2805 · diffplug/spotless
Attempts to fix #2816
The maven plugin recalculates the list of dirty files using GitRatchetMaven::getDirtyFiles for each maven module and FormatterFactory. Calculating the list is expensive for large git repositories.
This PR introduces a cache that stores the set of dirty files for a given (repository, ratchetFrom) combination and returns the cached value when available.
On a large git repository with >20 modules and >10k java files, this change reduces the time to run spotless:check from ~7s to <1s.