Skip to content

Stopped working with pre-commit #1159

Closed

Description

@x249wang

I keep getting the following error when trying to use pre-commit codespell hook on my repository (I was able to use it a few weeks ago). I've tried reinstalling pre-commit, upgrading git, as well as cloning my repository again. Is anyone having the same issue?

[INFO] Initializing environment for https://github.com/codespell-project/codespell.
An unexpected error has occurred: CalledProcessError: Command: ('C:\\Program Files\\Git\\mingw64\\bin\\git.exe', 'fetch', 'origin', '--tags')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
    From https://github.com/codespell-project/codespell
     * [new branch]      dict              -> origin/dict
     * [new branch]      master            -> origin/master
     * [new branch]      peternewman-aspell-dict-check -> origin/peternewman-aspell-dict-check
     * [new branch]      peternewman-bodgy -> origin/peternewman-bodgy
     * [new branch]      pr-skip           -> origin/pr-skip
    error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create 'C:/Users/<user>/.cache/pre-commit/repo5tf14_g0/.git/refs/remotes/origin/pr/aux.lock': No such file or directory
     ! [new branch]      pr/aux            -> origin/pr/aux  (unable to update local ref)
     * [new branch]      pr/fix-install    -> origin/pr/fix-install
     * [new branch]      v1.0.x            -> origin/v1.0.x
     * [new branch]      v1.1.x            -> origin/v1.1.x
     * [new branch]      v1.2.x            -> origin/v1.2.x
     * [new tag]         1.10.0            -> 1.10.0
     * [new tag]         log               -> log
     * [new tag]         v0.9              -> v0.9
     * [new tag]         v1.0              -> v1.0
     * [new tag]         v1.0-rc1          -> v1.0-rc1
     * [new tag]         v1.0-rc2          -> v1.0-rc2
     * [new tag]         v1.0-rc3          -> v1.0-rc3
     * [new tag]         v1.0.1            -> v1.0.1
     * [new tag]         v1.0.2            -> v1.0.2
     * [new tag]         v1.0.3            -> v1.0.3
     * [new tag]         v1.1              -> v1.1
     * [new tag]         v1.1-rc1          -> v1.1-rc1
     * [new tag]         v1.1-rc2          -> v1.1-rc2
     * [new tag]         v1.1.1            -> v1.1.1
     * [new tag]         v1.10.0           -> v1.10.0
     * [new tag]         v1.11.0           -> v1.11.0
     * [new tag]         v1.12.0           -> v1.12.0
     * [new tag]         v1.13.0           -> v1.13.0
     * [new tag]         v1.14.0           -> v1.14.0
     * [new tag]         v1.15.0           -> v1.15.0
     * [new tag]         v1.2              -> v1.2
     * [new tag]         v1.3              -> v1.3
     * [new tag]         v1.4              -> v1.4
     * [new tag]         v1.5              -> v1.5
     * [new tag]         v1.6              -> v1.6
     * [new tag]         v1.7              -> v1.7
     * [new tag]         v1.8              -> v1.8
     * [new tag]         v1.9.0            -> v1.9.0
     * [new tag]         v1.9.1            -> v1.9.1
     * [new tag]         v1.9.2            -> v1.9.2

Activity

  1. peternewman commented on Jun 18, 2019

    @peternewman
    Collaborator

    Hi @x249wang ,

    Where did the hook come from?

    I can see @marco-c added stuff in #1117 referencing https://pre-commit.com/ but we don't seem to have made it into the hook list ( https://pre-commit.com/hooks.html via https://github.com/pre-commit/pre-commit.github.io/blob/real_master/all-repos.yaml ).

    The issue looks to be because @lucasdemarchi had some branches with slashes in the name, which is confusing Windows as it sees them as folder paths *although they're all a few years old, so I don't know why it's suddenly got upset):
    https://github.com/codespell-project/codespell/branches/all

    It looks like one was merged successfully so we could just delete it, the one one got closed, so can probably go, but we ought to check with him.

    If you can get pre-commit to only check-out master, then I think it would all just work.

  2. peternewman commented on Jun 18, 2019

    @peternewman
    Collaborator

    See also discussion in pre-commit/pre-commit#1058 .

  3. larsoner commented on Jun 18, 2019

    @larsoner
    Member

    Thanks for the investigation @peternewman, I agree those look like cruft so I've deleted them. @lucasdemarchi if you need the branches I do have local copies I could push to your fork.

    (As an aside, it's pretty common for repos to have / in PR names since often there is maint/X.XX or maintenance/X.XX so I assume they'll have to fix this upstream at some point.)

  4. peternewman commented on Jun 18, 2019

    @peternewman
    Collaborator

    (As an aside, it's pretty common for repos to have / in PR names since often there is maint/X.XX or maintenance/X.XX so I assume they'll have to fix this upstream at some point.)

    Thanks @larsoner . Agreed, although as they mentioned in the other issue, it looks like a bug in Git on Windows not handling slashes if anything.

  5. peternewman commented on Jun 18, 2019

    @peternewman
    Collaborator

    I can see @marco-c added stuff in #1117 referencing https://pre-commit.com/ but we don't seem to have made it into the hook list ( https://pre-commit.com/hooks.html via https://github.com/pre-commit/pre-commit.github.io/blob/real_master/all-repos.yaml ).

    It's now on the website via pre-commit/pre-commit.com#237

  6. asottile commented on Jun 18, 2019

    @asottile
    Contributor

    I mailed the git mailing list, they helpfully pointed out that it's not the directory but the name "aux":

    AUX is a reserved filename on Windows. Quoting from that source:

    Do not use the following reserved names for the name of a file:
    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,
    COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and
    LPT9. Also avoid these names followed immediately by an
    extension...
    

    The default Git "ref store" is filesystem-based, so a branch named
    "aux" is problematic. Other ref store implementations would not be
    subject to this limitation (though I'm not sure what the state of the
    others is -- someone with more knowledge can probably answer that).

  7. x249wang commented on Jun 19, 2019

    @x249wang
    Author

    That fixed the issue for me. Thank you!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions