From 1ab6482ecb81c697a8a66eb9d790c36d1cd625fa Mon Sep 17 00:00:00 2001 From: finswimmer Date: Tue, 13 Sep 2022 14:18:58 +0200 Subject: [PATCH] docs: added note about `pre-commit autoupdate` (#6497) Added explanation to docs why `pre-commit autoupdate` will not find latest version for Poetry's hooks. (cherry picked from commit 890c6a33eb49d8eafa55ed11bcc9b32e0205f81b) --- docs/pre-commit-hooks.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index a032c10e6cd..7fa16e8e896 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -24,7 +24,6 @@ the defaults are overwritten. You must fully specify all arguments for your hook if you make use of `args:`. {{% /note %}} - ## poetry-check The `poetry-check` hook calls the `poetry check` command @@ -99,3 +98,24 @@ repos: - id: poetry-export args: ["-f", "requirements.txt", "-o", "requirements.txt"] ``` + +## FAQ + +### Why does `pre-commit autoupdate` not update to the latest version? + +`pre-commit autoupdate` updates the `rev` for each repository defined in your `.pre-commit-config.yaml` +to the latest available tag in the default branch. + +Poetry follows a branching strategy, where the default branch is the active developement branch +and fixes gets back ported to stable branches. New tags are assigned in these stable branches. + +`pre-commit` does not support such a branching strategy and has decided to not implement +an option, either on the [user side](https://github.com/pre-commit/pre-commit/issues/2512) +or [hook author side](https://github.com/pre-commit/pre-commit/issues/2508), to define a branch for lookup the latest +available tag. + +Thus, `pre-commit autoupdate` is not usable for the hooks described here. + +You can avoid changing the `rev` to an unexpected value, by using the `--repo` parameter (may be specified multiple +times), to explicit list repositories that should be updated. An option to explicit exclude +repositories [will not be implemented](https://github.com/pre-commit/pre-commit/issues/1959) into `pre-commit`.