ics_cli/git-hooks/pre-commit

30 lines
694 B
Plaintext
Raw Normal View History

2024-07-08 20:25:54 +02:00
#!/bin/bash
# make a dir called git-hooks in the top level of your repo
# put the following line in a Readme.md:
# git config --local core.hooksPath git-hooks
# the user has to actively enable git hooks
# this script has to be named "pre-commit" and should be placed
# in the core.hooksPath
if type ctags &>> /dev/null; then
ctags_installed=1
else
ctags_installed=0
fi
if ! (( ${ctags_installed} )); then
2024-07-08 20:39:44 +02:00
printf "Ctags is not installed! Git hooks are enabled and can only be executed if it is installed.\n"
printf "Commit was aborted.\n"
exit 1
2024-07-08 20:25:54 +02:00
fi
if ! ctags -R src/.; then
2024-07-08 20:39:44 +02:00
printf "Ctags failed.\n\n"
2024-07-08 20:25:54 +02:00
exit 1
else
2024-07-08 20:39:44 +02:00
printf "Ctags was successfully executed.\n"
2024-07-08 20:25:54 +02:00
fi
exit 0