How to ignore `rev` in pre-commit config?
Asked Answered
D

1

5

Here is a .pre-commit-config.yaml from pre-commit.
It will git clone the specified rev of git repo.
How can I ignore the rev and always git clone the newest?

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
Delorenzo answered 3/4, 2023 at 14:13 Comment(0)
P
12

you intentionally cannot

from the docs

pre-commit configuration aims to give a repeatable and fast experience and therefore intentionally doesn't provide facilities for "unpinned latest version" for hook repositories.

Instead, pre-commit provides tools to make it easy to upgrade to the latest versions with pre-commit autoupdate. If you need the absolute latest version of a hook (instead of the latest tagged version), pass the --bleeding-edge parameter to autoupdate.

pre-commit assumes that the value of rev is an immutable ref (such as a tag or SHA) and will cache based on that. Using a branch name (or HEAD) for the value of rev is not supported and will only represent the state of that mutable ref at the time of hook installation (and will NOT update automatically).


disclaimer: I wrote pre-commit

Psychoanalysis answered 3/4, 2023 at 14:19 Comment(1)
Makes 100% sense assuming. if this picked up the latest version, this alone would have been a source of inconsistent states.Upstairs

© 2022 - 2024 — McMap. All rights reserved.