Introduces a `--walk` flag which can be used to tell `treefmt` how to traverse the directory specified by `--tree-root`.
By default, it will attempt to use `git ls-files`. If this fails, it falls back to using the filesystem.
You can explicitly traverse the filesystem instead of using git by providing `--walk filesystem`.
Close#1
Signed-off-by: Brian McGee <brian@bmcgee.ie>
When running against nixpkgs we were stalling. This was due to a long running read tx which was preventing any writes.
This breaks up reading the cache when walking the filesystem into many smaller read txs.
On my laptop I'm now getting the following with the echo sample:
```console
# fresh cache
❯ nix run .# -- -c --config-file ./test/echo.toml --tree-root ../../../github.com/nixos/nixpkgs
38825 files changed in 320.655826ms
# hot cache
❯ nix run .# -- --config-file ./test/echo.toml --tree-root ../../../github.com/nixos/nixpkgs
0 files changed in 252.920853ms%
```
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #18
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Closes#10
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #15
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Closes#8
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #16
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Since we discussed this in #14 (comment)
It doesn't really matter.
Reviewed-on: #17
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
Tracks the mod time and size of a formatter's executable in bolt.
The cache is busted using the following criteria:
- a new formatter has been configured.
- an existing formatter has changed (mod time or size)
- an existing formatter has been removed from config
Also implemented better resolution of symlinks when determining a formatters executable path.
Reviewed-on: #14
Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com>
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Co-committed-by: Brian McGee <brian@bmcgee.ie>
Stacked on top of #11
Co-authored-by: Brian McGee <brian@bmcgee.ie>
Reviewed-on: #13
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>
The package was created before Go introduced their own "errors"
package.
Trade the better juju errors semantic for a smaller dependency tree.
Reviewed-on: #11
Co-authored-by: zimbatm <zimbatm@zimbatm.com>
Co-committed-by: zimbatm <zimbatm@zimbatm.com>