Closed yenaing-oo closed 1 month ago
This is definitely much cleaner!
I tested it out, and there is a change and additional steps required to make it work:
cat << EOF > .git/hooks/pre-commit
to cat << 'EOF' > .git/hooks/pre-commit
to interpret the REPO_ROOT
variable when the hook is called, rather than when writing the content of the hook file..git/hooks/pre-commit
hook to be executableI think we can do away with the installation script and simply include the pre-commit
hook with executable permissions and track that. Because git uses the hooks in .git/hooks
by default, I found a way to configure git to use our custom git hooks instead, by calling:
git config core.hooksPath <custom_githooks_dir_name>
I've made these changes in my PR.
I believe the default behaviour of git config
is local.
https://git-scm.com/docs/git-config#_description
When writing, the new value is written to the repository local configuration file by default, and options --system, --global, --worktree, --file
can be used to tell the command to write to that location (you can say --local but that is the default).
Notes