You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now lefthook automatically installs github hooks files in the git rev-parse --git-path hooks folder
This folder should be configurable.
Value
Every systems is configured differently,
A common scenario is to setup a global hook folder that contains all the github hooks that will delegate to other scripts stored in different directories.
A use case would be to have script executed on all your repositories installed on your computer but also add custom hooks at each repos level
e.g
~/.gitconfig
[core]
hooksPath=~/hooks
~/.hooks/pre-commit hooks that execute global scripts + delegate to individual repo pre-commit hooks if needed
Hey! Could you please provide more details about the suggested setting?
Git uses only one dir for hooks, so if you have ~/hooks configured and run git commit - a ~/hooks/pre-commit will be triggered. If this is your manual hook, then what's the purpose of having different hooks dir for lefthook? It looks like lefthook hooks won't be executed in this scenario.
And if you have lefthook hook installed in ~/hooks/pre-commit, then you'll have repo-specific commands anyway, because settings are parsed from your repo's lefthook.yml, they are not global.
Git uses only one dir for hooks, so if you have ~/hooks configured and run git commit - a ~/hooks/pre-commit will be triggered. If this is your manual hook, then what's the purpose of having different hooks dir for lefthook? It looks like lefthook hooks won't be executed in this scenario.
Here is the scenario
The global pre-commit actually looks into the current repo local .hooks/pre-commit and execute that script if it exits
So if i do a git commit from the repoA folder for example ~/hooks pre-commit is executed, looks for repoA/.hooks/pre-commit and execute that script
What i m trying to do is install lefthook just for repoA but I dont want other repos to use it
So i want to configure repoA/lefthook.yml to install the lefthook precommit script automatically in repoA/.hooks/pre-commit
That way I can still use global hooks that will be executed on ALL repos precommit and also execute lefthook on repoA
This is why i would like that have this option that way lefthook never override my global/pre-commit script.
⚡ Summary
Right now lefthook automatically installs github hooks files in the
git rev-parse --git-path hooks
folderThis folder should be configurable.
Value
Every systems is configured differently,
A common scenario is to setup a global hook folder that contains all the github hooks that will delegate to other scripts stored in different directories.
A use case would be to have script executed on all your repositories installed on your computer but also add custom hooks at each repos level
e.g
~/.gitconfig
~/.hooks/pre-commit hooks that execute global scripts + delegate to individual repo pre-commit hooks if needed
~/repo1/.hooks/pre-commit
~/repo2/.hooks/pre-commit
Behavior and configuration changes
Add a new configuration at the root level
use that directory when installing and synchronizing hooks scripts
e.g if you are in
~/repo1
.lefthook install
will add git hooks scripts to~/repo1/.hooks
If
hooks_folder
is not provided fallback togit rev-parse --git-path hooks
The text was updated successfully, but these errors were encountered: