File tree 1 file changed +9
-1
lines changed 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 331
331
ln -s ${ configFile } .pre-commit-config.yaml
332
332
# Remove any previously installed hooks (since pre-commit itself has no convergent design)
333
333
hooks="pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit"
334
+ uninstall_help=$(pre-commit uninstall --help)
335
+ install_help=$(pre-commit install --help)
334
336
for hook in $hooks; do
335
- pre-commit uninstall -t $hook
337
+ # different version of pre-commit support different hooks
338
+ [[ "$uninstall_help" =~ "$hook" ]] && pre-commit uninstall -t $hook
336
339
done
337
340
# Add hooks for configured stages (only) ...
338
341
if [ ! -z "${ concatStringsSep " " cfg . default_stages } " ]; then
339
342
for stage in ${ concatStringsSep " " cfg . default_stages } ; do
343
+ [[ "$stage" == "manual" ]] && continue
344
+ # different version of pre-commit support different hooks
345
+ if [[ ! "$install_help" =~ "$stage" ]];then
346
+ echo 1>&2 "WARNING: nix-pre-commit-hooks: '$stage' is not supported by this pre-commit version."
347
+ continue
340
348
case $stage in
341
349
commit | merge-commit | push)
342
350
stage="pre-"$stage
You can’t perform that action at this time.
0 commit comments