install.fairie/home/.chezmoiscripts/universal/run_onchange_after_08-git-hooks.tmpl
2023-01-24 18:06:47 +00:00

20 lines
705 B
Cheetah

{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
{{ $gitHooks := (output "find" (joinPath .chezmoi.homeDir ".local" "src" "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 are executable
logg info 'Ensuring git hooks are executable'
find "$HOME/.local/src/shared-common/common/.config/husky" -mindepth 1 -maxdepth 1 -type f | while read HOOK; do
chmod +x "$HOOK"
done
{{ end -}}