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

bug: pre-commit's script is installed in migration mode #502

Open
joscha opened this issue Oct 8, 2024 · 7 comments
Open

bug: pre-commit's script is installed in migration mode #502

joscha opened this issue Oct 8, 2024 · 7 comments

Comments

@joscha
Copy link
Contributor

joscha commented Oct 8, 2024

I randomly started getting:

bug: pre-commit's script is installed in migration mode
run `pre-commit install -f --hook-type commit-msg` to fix this

unsure where the issue is.
I did find pre-commit/pre-commit#1419 and commented there, however, it was locked by the project owner there unfortunately, suggesting we might be the culprit.

Any ideas?

git config --unset-all core.hooksPath
pre-commit install -f --hook-type commit-msg

fixed it, but I am unsure if I have now bypassed some of the logic from git-hooks.nix.

@sandydoo
Copy link
Member

sandydoo commented Oct 8, 2024

What even is migration mode?

@joscha
Copy link
Contributor Author

joscha commented Oct 8, 2024

What even is migration mode?

I think it refers to this: https://github.com/pre-commit/pre-commit.com/blob/main/sections/advanced.md#running-in-migration-mode

But I haven't done anything to the install other than updating my flake.lock

@joscha
Copy link
Contributor Author

joscha commented Oct 8, 2024

I do sometimes run pre-commit run --all-files directly from my cmd, could that be an issue?

@sandydoo
Copy link
Member

sandydoo commented Oct 8, 2024

I do sometimes run pre-commit run --all-files directly from my cmd, could that be an issue?

That's completely fine. We don't patch pre-commit, despite what the maintainers of pre-commit insist on saying...

It looks like they're searching for a hash in .git/hooks/<hook_stage>, and if they don't find it, they error out. We call pre-commit install internally, so I'm not really sure why this hash would be missing.

@sandydoo
Copy link
Member

sandydoo commented Oct 8, 2024

If anyone encounters this, please save a copy of .git/hooks before trying to fix the error. The files in there would really help debug this issue.

@joscha
Copy link
Contributor Author

joscha commented Oct 8, 2024

I do sometimes run pre-commit run --all-files directly from my cmd, could that be an issue?

That's completely fine. We don't patch pre-commit, despite what the maintainers of pre-commit insist on saying...

@asottile this may have been outdated information. Might be worth unlocking that issue, so at least the two issues get cross-referenced for others to find.

@joscha
Copy link
Contributor Author

joscha commented Oct 8, 2024

If anyone encounters this, please save a copy of .git/hooks before trying to fix the error. The files in there would really help debug this issue.

I had that as an afterthought. I also didn't look at core.hooksPath either before blowing it away 🤦 . If/when it happens again I'll report here.

@joscha joscha changed the title bug: pre-commit's script is installed in migration mode bug: pre-commit's script is installed in migration mode Oct 8, 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

No branches or pull requests

2 participants