I plan to write a few git hooks as a project that logs user actions in the database. Then this database can be used to request all its actions. The actions I'm trying to perform are
- commit
- to pull
- push
- mergers
- branch
I want to get this package in distributions, which can be installed through the package manager. Git allows global intercepts by putting any such in $PREFIX/share/templates/hooks
He currently has some interceptors that are disabled ( .sample appended to their name). When a new repository is created, these hooks are copied to the repository's .git folder
Now, if the user installs a package for these hooks, and hooks such as post-commit and post-update are already included. In this case, the script file will be overwritten! That sounds bad.
This means that git has only one file per click per action. If I need to hold three hooks for one action, this means that this is not possible. This means that silent installation from the package manager can lead to conflicts.
Now think that we packed the hooks to overwrite the file with the default enabled. If the user wants to add a few more actions to this file, and then decided to delete my package, will his user command also disappear?
I thought git was pretty smart in this regard, and I was wrong :(
There must be a folder called post-commit and post-update or any actions and git should run all the scripts inside this folder. I am still hunting for a way to handle the current situation.
git scripting githooks
Manish sinha
source share