Skip to content

Commit bacef6a

Browse files
[1.2] docs: added note about pre-commit autoupdate (#6502)
Backport 890c6a3 from #6497. Co-authored-by: finswimmer <finswimmer77@gmail.com>
1 parent 5535e13 commit bacef6a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/pre-commit-hooks.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ the defaults are overwritten. You must fully specify all arguments for
2424
your hook if you make use of `args:`.
2525
{{% /note %}}
2626

27-
2827
## poetry-check
2928

3029
The `poetry-check` hook calls the `poetry check` command
@@ -99,3 +98,24 @@ repos:
9998
- id: poetry-export
10099
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
101100
```
101+
102+
## FAQ
103+
104+
### Why does `pre-commit autoupdate` not update to the latest version?
105+
106+
`pre-commit autoupdate` updates the `rev` for each repository defined in your `.pre-commit-config.yaml`
107+
to the latest available tag in the default branch.
108+
109+
Poetry follows a branching strategy, where the default branch is the active developement branch
110+
and fixes gets back ported to stable branches. New tags are assigned in these stable branches.
111+
112+
`pre-commit` does not support such a branching strategy and has decided to not implement
113+
an option, either on the [user side](https://github.com/pre-commit/pre-commit/issues/2512)
114+
or [hook author side](https://github.com/pre-commit/pre-commit/issues/2508), to define a branch for lookup the latest
115+
available tag.
116+
117+
Thus, `pre-commit autoupdate` is not usable for the hooks described here.
118+
119+
You can avoid changing the `rev` to an unexpected value, by using the `--repo` parameter (may be specified multiple
120+
times), to explicit list repositories that should be updated. An option to explicit exclude
121+
repositories [will not be implemented](https://github.com/pre-commit/pre-commit/issues/1959) into `pre-commit`.

0 commit comments

Comments
 (0)