38 lines
1.6 KiB
Cheetah
38 lines
1.6 KiB
Cheetah
{{- if false -}}
|
|
#!/usr/bin/env bash
|
|
### This script is `if false` blocked out! ###
|
|
# This script is disabled until we figure out sensible git hooks for linters / auto-fixers
|
|
# that are not too aggressive. Megabyte Labs projects can install git hooks by running
|
|
# `bash start.sh`.
|
|
#
|
|
# To re-enable, add the missing files to the ~/.config/git/template folder, uncomment the templatedir line
|
|
# in ~/.config/git/config, and uncomment the Husky script in .chezmoiexternal.toml. Then, move this file to
|
|
# the universal folder.
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
{{ $gitHooks := (output "find" (joinPath .chezmoi.homeDir ".local" "share" "shared-common" "common" ".config" "husky") "-mindepth" "1" "-maxdepth" "1" "-type" "f") -}}
|
|
{{- range $gitHook := splitList "\n" $gitHooks -}}
|
|
{{- if ne $gitHook "" -}}
|
|
# {{ $gitHook }} hash: {{ include $gitHook | sha256sum }}
|
|
{{- end -}}
|
|
{{- end }}
|
|
|
|
### Ensure git hooks directory exists
|
|
gum log -sl info 'Ensuring git hooks directory exists'
|
|
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks"
|
|
|
|
### Ensure git hooks are executable
|
|
gum log -sl info 'Ensuring git hooks are up-to-date'
|
|
find "${XDG_DATA_HOME:-$HOME/.local/share}/shared-common/common/.config/husky" -mindepth 1 -maxdepth 1 -type f | while read HOOK; do
|
|
cp "$HOOK" "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks"
|
|
done
|
|
|
|
### Make git hooks executable
|
|
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks" ]; then
|
|
gum log -sl info 'Ensuring git hooks are executable'
|
|
chmod +x "${XDG_CONFIG_HOME:-$HOME/.config}/git/template/hooks/"*
|
|
fi
|
|
|
|
{{ end -}}
|