devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Remove all hooks from .pre-commit-config.yaml if disabled

Open jashandeep-sohi opened this issue 9 months ago • 1 comments

While in the shell, I occasionally like to use the pre-commit CLI directly. This works well, expect when you disable git-hooks. In that case, .pre-commit-config.yaml goes out of sync, because currently it is only updated if at least one pre-commit hook is enabled https://github.com/cachix/devenv/blob/74832581642f2a59f0c2a5b74c6ef221080f3c39/src/modules/integrations/git-hooks.nix#L43

Would it be possible to always run https://github.com/cachix/devenv/blob/74832581642f2a59f0c2a5b74c6ef221080f3c39/src/modules/integrations/git-hooks.nix#L49 to make sure all disabled hooks are removed?

jashandeep-sohi avatar Feb 24 '25 22:02 jashandeep-sohi

Would love to get this fixed, happy to accept a PR!

domenkozar avatar Feb 25 '25 05:02 domenkozar

We should probably just remove the file if there are no hooks and the file is a symlink to the store

domenkozar avatar Mar 11 '25 07:03 domenkozar

This was fixed in https://github.com/cachix/devenv/pull/1751

domenkozar avatar Nov 19 '25 15:11 domenkozar