-
Notifications
You must be signed in to change notification settings - Fork 51
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
Ignore commit amend message files in .git when running forbid-tabs & co by default #74
Comments
Hi @xaver-k! I agree that this would make sense. You can already use the We could also probably add this entry in the https://github.com/Lucas-C/pre-commit-hooks/blob/master/.pre-commit-hooks.yaml file in this repository |
Hi @Lucas-C Regarding a fix: I would prefer to fix the root cause here via a PR and just bump the version in all of my repositories instead of maintaining a workaround through a custom |
Alright, no hurry! I wish nice holidays! And sure, a PR would be welcome |
So, I found the root-cause now and have a reproduce: https://github.com/xaver-k/no-tabs-pre-commit-hook-bug-reporduce The issue is that the hook does not explicitly defines which stages to run at (see https://pre-commit.com/#hooks-stages), so it just runs for all stages. This means that in our case, it is also run at the If it works for you, I would make a PR that confines the hooks to only run at the following stages: For the other stages, I do not see a usecase for checking tabs / line endings: |
Makes sense! I'm not even sure the |
Just for completeness, I found the hooks useful at the |
When amending to an existing commit, forbid-tabs detects tabs in the
git/COMMIT_EDITMSG
and fails the check. The tab is part of the message that is auto-generated by git to inform about the history of the commit, so it is not the user's fault.Example output:
Example git message:
The file should probably be ignored by the hook by default. However, I am not sure what the best approach for that would be here.
Options are to either ignoring the specific file (might not be enough in similar scenarios) OR a set of specific files (which ones) or everything in .git (might break some use-cases).
The text was updated successfully, but these errors were encountered: