improve: nix flakebox fmt

This commit is contained in:
thesimplekid
2023-10-22 16:42:22 +01:00
parent dafa0079e8
commit bf5ea01c1f
80 changed files with 1028 additions and 261 deletions

23
misc/git-hooks/commit-msg Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Sanitize file first, by removing leading lines that are empty or start with a hash,
# as `convco` currently does not do it automatically (but git will)
# TODO: next release of convco should be able to do it automatically
MESSAGE="$(
while read -r line ; do
# skip any initial comments (possibly from previous run)
if [ -z "${body_detected:-}" ] && { [[ "$line" =~ ^#.*$ ]] || [ "$line" == "" ]; }; then
continue
fi
body_detected="true"
echo "$line"
done < "$1"
)"
# convco fails on fixup!, so remove fixup! prefix
MESSAGE="${MESSAGE#fixup! }"
if ! convco check --from-stdin <<<"$MESSAGE" ; then
>&2 echo "Please follow conventional commits(https://www.conventionalcommits.org)"
>&2 echo "Use git recommit <args> to fix your commit"
exit 1
fi