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

Add ability to extend the set of Git pre-commit hooks #65078

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

RandomShaper
Copy link
Member

This is very useful for forks of Godot with custom needs.

@RandomShaper RandomShaper added enhancement cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Aug 30, 2022
@RandomShaper RandomShaper added this to the 4.0 milestone Aug 30, 2022
@RandomShaper RandomShaper requested a review from a team as a code owner August 30, 2022 10:26
@akien-mga
Copy link
Member

akien-mga commented Aug 30, 2022

@Faless suggested on chat to add misc/hooks/pre-commit-custom-* to .gitignore, which I think is a good idea.

In theory it shouldn't be needed as the custom hooks have to be placed in .git/hooks/ and so they don't need to be in misc/hooks/. But I personally tend to make my .git/hooks a symlink to misc/hooks so that hooks update automatically, so for my use case I'd actually want to put custom hooks in misc/hooks/.

@RandomShaper
Copy link
Member Author

I'm quite a noob in what comes to Git hooks. How does Git pick additional hooks normally without modifying the list of known pre-commit hooks in the main pre-commit script?

@akien-mga
Copy link
Member

akien-mga commented Aug 30, 2022

I'm quite a noob in what comes to Git hooks. How does Git pick additional hooks normally without modifying the list of known pre-commit hooks in the main pre-commit script?

What I do is symlink the whole misc/hooks/ folder to .git/hooks/. So if a new pre-commit hook is added upstream, and included in misc/hooks/pre-commit, then I get it automatically via the symlink.

But otherwise when not using a symlink, it does require a manual update (at least with the format we use for pre-commit hooks, there are likely other ways to enable them more dynamically, e.g. #46235).

@RandomShaper
Copy link
Member Author

Oh, I wasn't getting it right. It's clear now.

@akien-mga akien-mga merged commit 08eafbd into godotengine:master Aug 30, 2022
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the git_hooks_extend branch August 30, 2022 14:35
@akien-mga
Copy link
Member

Cherry-picked for 3.6.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Sep 1, 2022
@akien-mga
Copy link
Member

Cherry-picked for 3.5.1.

@akien-mga akien-mga removed the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants