I have just started with devenv.sh (and Nix) and I have something working. So far, so good.
Unfortunately, it appears that it always enables pre-commit-hooks which then forces various changes to my Git setup and breaks basic Git functionality.
I get the impression that it comes in through my inputs, i.e. I see it listed under “Inputs:” when running devenv info. Is there any way to delete from inputs? How should I go about removing pre-commit-hooks?
No, I did not. I did not touch the pre-commit-hook functionality at all. Until I noticed it had been enabled.
My best workaround (that I am not happy with) is to set PRE_COMMIT_ALLOW_NO_CONFIG and to remove .pre-commit-config.yaml but that leaves an annoying warning: “.pre-commit-config.yaml config file not found. Skipping pre-commit.”.
(I am curious why .pre-commit-config.yaml is not recreated? I never created it but exiting and re-entering the directory does not recreate it. To be clear, I don’t want it recreated, I am just surprised that it’s not being recreated. )
The best I have come up with so far is to have a minimal .pre-commit-config.yaml with just repos: []. It does not seem like I need to disable any pre-commit checks.
We already have quite a few dot files so I would prefer not to add to it. So, @domenkozar if you could make it so pre-commit-hooks is totally invisible unless explicitly enabled, that would be awesome. I think the issue you linked to is about that? For now, I will just go with the minimal .pre-commit-config.yaml.
I’ll look into the issue soon, thanks for raising this up.
Most likely you had a pre-commit hook at some point, which installed .git/hooks/pre-commit. That’s what this issue is about, removing it if pre-commit is disabled.
Ah, there is a .git/hooks/pre-commit but the timestamp is December 21st. So it was somehow installed very recently and not by me (or at least not by me directly).
That’s right. The tricky bit to do this automatically is that you might want to manage pre-commit hooks outside of devenv, so we somehow need to know it was installed by us.