Reduce number of hooks run over Githooks
gabyx opened this issue · comments
To reduce the number hooks run over Githooks, the user could modify them
git hooks config maintained-hooks [--local] [--global] "-post-index-change" "-reference-transaction" # all + remove
git hooks config maintained-hooks [--local] [--global] "-all" "pre-commit" "post-commit" "post-merge" # empty, add back
All commands will set the githooks.maintainedHooks
variable either in local (set Ml
) or global scope (set Mg
) .
LFS related hooks can never be removed, only by githooks uninstall.
-/(+)
determine whats included,all
is the whole set.- predefined set
server
,all
(for--local
operation,all
corresponds to server or non-server hooks) - --local: Updates the run wrappers inside the repository.
- Warns if core.hooksPath is set.
- --global : Updates the global run wrappers (
init.temlateDir
orcore.hooksPath
).- If not using core.hooksPath, asks if registered repos without a local overwrite
Ml
, should be updated, to reflect that change too, default yes.
- If not using core.hooksPath, asks if registered repos without a local overwrite
- Git LFS hooks can never be unset, they are always part.
-
New installs will only read
--global githooks.maintainedHooks
(or legacy githooks.maintainOnlyServerHooks) and overiden by arguments--maintained-hooks
values:server, all, [-]<hook-name>
).- It will set
--global githooks.maintainedHooks
. - It will delete legacy
githooks.maintainOnlyServerHooks
in favor of the above. - Run wrappers are set according to this set.
- Automatic installing into registered repositories -> see 3.
- It will set
-
Manual and auto-updates runs exactly as point 1.
-
Local
git hooks install
will use first only--local githooks.maintainedHooks
if set otherwise the global one is used, or defaultall
(all hooks depending on bare/non-bare repo). -
Local
git hooks uninstall
will remove Githooks: iterate over all detected Githooks and deletes it and reinstalls replaced hooks (no LFS statements possible), and if git-lfs rungit lfs install
. All because, if the user changes the maintained hooks, when using Githooks, some repos might have another set, which complicates things.
Notes: -all == - (ManagedHookNames - LFSHookNames)
and -server == - (ManagedServerHookNames - LFSHookNames)
PR #74
Implements this. Readme will come.
Another PR is neede to add CLI integeration.
For 1.i and 1.ii