Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set explicit version in precommit snippet #354

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

corneliusroemer
Copy link
Contributor

When using rev: main, pre-commit throws the following warning:

pre-commit run --all-files               
[WARNING] The 'rev' field of repo 'https://github.com/rhysd/actionlint' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  Hint: `pre-commit autoupdate` often fixes this.

From https://pre-commit.com/#using-the-latest-version-for-a-repository:

Using the latest version for a repository ¶
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).

When using `rev: main`, pre-commit throws the following warning:
```log
pre-commit run --all-files               
[WARNING] The 'rev' field of repo 'https://github.com/rhysd/actionlint' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  Hint: `pre-commit autoupdate` often fixes this.
```

From https://pre-commit.com/#using-the-latest-version-for-a-repository:
>Using the latest version for a repository ¶
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).
@rhysd
Copy link
Owner

rhysd commented Feb 14, 2024

Thanks for your suggestion. I think recommending fixed version would be a good idea. On the other hand it is a bit hard to maintain the version in the document up-to-date. So I'd like to add a note to the usage document rather than modifying the example directly.
After merging this PR, I'll add the modification.

@rhysd rhysd merged commit 70cd2de into rhysd:main Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants