numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
590 stars 37 forks source link

cache gets busted on treefmt-nix config changes #216

Open zimbatm opened 1 year ago

zimbatm commented 1 year ago

Describe the bug

The cache is stored in ~/.cache/treefmt/<hash-of-project.toml-path>.toml (see https://github.com/numtide/treefmt/blob/e51789fe1ed92795c0ba89ca7c74c34acd8b95ca/src/eval_cache.rs#L203) With treefmt-nix, the config file gets a new path on every config change, invalidating the cache entirely.

A better solution would be to use the projectRoot path as a cache key.

brianmcgee commented 1 month ago

I don't believe this is an issue in v2 any more, but I need to double check.