mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
654d99fbca
* Switch from husky+precommit to lefthook Migrate from husky/precommit to lefthook h old husky precommit lefthook so far remove husky folder switch to new lefthook package Add postinstall script to clean up after husky preinstall to remove husky config package.json package.json package.json script v Reduce lefthook output Cleanup testing reduce output testing betterer testing betterer testing betterer testing betterer testing betterer testing betterer testing betterer skip skipping execution info small cleanup remove comment from testing clean up old husky hooks in .git/hooks path run scripts in parallel update codeowners don't auto-install lefthook install lefthook with make command fix yarn checksum * update codeowners * don't use source because it isn't available in ubuntu/debian's /bin/sh * Ensure lefthook commits files fixed by precommit hooks * add comment to lefthook.rc explaining what it does * add i18n:pseudo precommit * Don't create .husky/safe-to-delete file anymore * cleanup old lint-staged config * contribute docs * update lefthook to 1.4.8 * Move frontend encouragement docs * rewrite husky cleanup script in bash so we can run it with make * Make old husky precommit script reject commits until husky is removed * log precommit warning for everyone * fix package.json * run lefthook hooks from old husky hook * run lefthook hooks from old husky hook * comments * codeowners * codeowners
56 lines
1.2 KiB
Bash
Executable File
56 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
|
|
|
|
# Husky modified your git config to store git hooks in the repo, so do that change
|
|
currentHooksPath=$(git config core.hooksPath || true)
|
|
if [[ $currentHooksPath == ".husky" ]]; then
|
|
if [ -z "$SILENT" ]; then
|
|
echo "Unsetting git hooks path because it was previously set to .husky."
|
|
echo "If you had custom git hooks in .husky you may want to move them to .git/hooks"
|
|
fi
|
|
|
|
git config --unset core.hooksPath
|
|
fi
|
|
|
|
oldHuskyHookNames=(
|
|
"applypatch-msg"
|
|
"commit-msg"
|
|
"post-applypatch"
|
|
"post-checkout"
|
|
"post-commit"
|
|
"post-merge"
|
|
"post-receive"
|
|
"post-rewrite"
|
|
"post-update"
|
|
"pre-applypatch"
|
|
"pre-auto-gc"
|
|
"pre-merge-commit"
|
|
"pre-push"
|
|
"pre-rebase"
|
|
"pre-receive"
|
|
"push-to-checkout"
|
|
"sendemail-validate"
|
|
"update"
|
|
)
|
|
|
|
#
|
|
# Also extra-old husky dumped a bunch of hooks into .git/hooks, so check for them
|
|
# and rename them so they don't run
|
|
for hookName in "${oldHuskyHookNames[@]}"; do
|
|
hookPath=".git/hooks/$hookName"
|
|
|
|
if [[ -f $hookPath ]]; then
|
|
if grep -q husky "$hookPath"; then
|
|
newHookPath="$hookPath.old"
|
|
|
|
if [ -z "$SILENT" ]; then
|
|
echo "Renaming old husky hook $hookPath to $newHookPath"
|
|
fi
|
|
|
|
mv "$hookPath" "$newHookPath" --suffix=old --backup=numbered
|
|
fi
|
|
fi
|
|
done
|