diff --git a/docs/mdbook/configuration/glob.md b/docs/mdbook/configuration/glob.md index e0f0da87..fce1a412 100644 --- a/docs/mdbook/configuration/glob.md +++ b/docs/mdbook/configuration/glob.md @@ -31,6 +31,23 @@ pre-commit: For patterns that you can use see [this](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm) reference. We use [glob](https://github.com/gobwas/glob) library. +***Behaviour of `**`*** + +Note that the behaviour of `**` is different from typical glob implementations, like `ls` or tools like `lint-staged` in that a double-asterisk matches 1+ directories deep, not zero or more directories. +If you want to match *both* files at the top level and nested, then rather than: + +```yaml +glob: "src/**/*.js" +``` + +You'll need: + +```yaml +glob: "src/*.js" +``` + +***Using `glob` without a files template in`run`*** + If you've specified `glob` but don't have a files template in [`run`](./run.md) option, lefthook will check `{staged_files}` for `pre-commit` hook and `{push_files}` for `pre-push` hook and apply filtering. If no files left, the command will be skipped. ```yml