Visitar URL original
running `pre-commit autoupdate` fails because tip of HEAD is missing hook 路 Issue #1708 路 pre-commit/pre-commit 路 GitHub
Skip to content

running pre-commit autoupdate fails because tip of HEAD is missing hook聽#1708

Description

@theod07

Hello 馃憢
I'm setting up pre-commit on a project and came across an issue when adding hook destroyed-symlinks. The error message suggested running pre-commit autoupdate. I ran that and saw that it cannot update because the tip of HEAD is missing that hook. I'm not sure what that means so posting here.

$ echo '    -   id: destroyed-symlinks' >> .pre-commit-config.yaml
$ git add -p !$
git add -p .pre-commit-config.yaml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index bfde4717..949f3ffc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,3 +21,4 @@ repos:
     -   id: check-vcs-permalinks
     -   id: check-xml
     -   id: debug-statements
+    -   id: destroyed-symlinks
(1/1) Stage this hunk [y,n,q,a,d,e,?]? y

$ git commit -m 'new hook destroyed-symlinks'
[ERROR] `destroyed-symlinks` is not present in repository https://github.com/pre-commit/pre-commit-hooks.  Typo? Perhaps it is introduced in a newer version?  Often `pre-commit autoupdate` fixes this.
$ git status
On branch pre-commit
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   .pre-commit-config.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        tests/__init__.py

$ pre-commit autoupdate
Updating https://github.com/pre-commit/pre-commit-hooks ... [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
Cannot update because the tip of HEAD is missing these hooks:
destroyed-symlinks
$ git checkout .
Updated 0 paths from the index
$ pre-commit autoupdate
Updating https://github.com/pre-commit/pre-commit-hooks ... Cannot update because the tip of HEAD is missing these hooks:
destroyed-symlinks
$ pre-commit --version
pre-commit 2.9.0

Activity

  1. asottile commented on Nov 22, 2020

    @asottile
    Member

    ah the error message never got updated from when the default behaviour of autoupdate switched from what is now --bleeding-edge to picking tags. pre-commit autoupdate --bleeding-edge can get you to that not-yet-released hook if you need it

    this should mention instead of "tip of HEAD" "update target" or "latest tag" or something of the sort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions