File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 329
329
echo 1>&2 " 3. add .pre-commit-config.yaml to .gitignore"
330
330
else
331
331
ln -s ${ configFile } .pre-commit-config.yaml
332
- pre-commit install
332
+ # Remove any previously installed hooks (since pre-commit iteslf has no idempotent design)
333
+ hooks="pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit"
334
+ for hook in $hooks; do
335
+ pre-commit uninstall -t $hook
336
+ done
337
+ # Add hooks for configured stages
338
+ if [ -z "${ lib . concatMapStringSep " " cfg . default_stages } " ]; then
339
+ for stage in ${ lib . concatMapStringSep " " cfg . default_stages } ; do
340
+ case $stage in
341
+ commit | merge-commit | push)
342
+ stage="pre-"$stage
343
+ ;;
344
+ *)
345
+ ;;
346
+ esac
347
+ pre-commit install -t $stage
348
+ done
349
+ # or simply 'pre-commit' hook
350
+ else
351
+ pre-commit install
352
+ fi
333
353
fi
334
354
fi
335
355
fi
You can’t perform that action at this time.
0 commit comments