captainhookphp / captainhook

CaptainHook is a very flexible git hook manager for software developers that makes sharing git hooks with your team a breeze.
http://captainhook.info
MIT License
1.01k stars 87 forks source link

Install command creates invalid .git/hooks/post-change if called explicitly #189

Closed sascha-egerer closed 1 year ago

sascha-egerer commented 1 year ago

Calling vendor/bin/captainhook install post-change creates a hook file in .git/hooks/post-change which does not make sense as it is only a "virtual hook" by captainhook. So this one should better create the hooks post-checkout post-mergepost-rewrite` or simply fail like if an invalid hook-name is given.

vendor/bin/captainhook install post-change
  'post-change' hook installed successfully
vendor/bin/captainhook install invalid

In Installer.php line 142:

  Invalid hook name 'invalid'

install [-c|--configuration [CONFIGURATION]] [-g|--git-directory [GIT-DIRECTORY]] [-f|--force] [-s|--skip-existing] [--move-existing-to [MOVE-EXISTING-TO]] [-b|--bootstrap [BOOTSTRAP]] [-m|--run-mode [RUN-MODE]] [-e|--run-exec [RUN-EXEC]] [-p|--run-path [RUN-PATH]] [--] [<hook>]
sebastianfeldmann commented 1 year ago

Thanks for the feedback. I changed the installer to make sure no virtual hook gets installed by accident.

Next release this will be fixed. Thanks again.

sebastianfeldmann commented 1 year ago

Just released version 5.11.1 including this fix.