Skip to content

Instantly share code, notes, and snippets.

@DannyDelott
Created July 10, 2016 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DannyDelott/c0fa3b89f3e930a335ddd402d7b13ee6 to your computer and use it in GitHub Desktop.
Save DannyDelott/c0fa3b89f3e930a335ddd402d7b13ee6 to your computer and use it in GitHub Desktop.
pre-push
#!/bin/bash
red=$'\e[1;31m'
grn=$'\e[1;32m'
yel=$'\e[1;33m'
blu=$'\e[1;34m'
mag=$'\e[1;35m'
cyn=$'\e[1;36m'
end=$'\e[0m'
exit_code=0
while read -r line; do
if [[ ! "$line" =~ ^\[(FE|BE|DOCS|BUILD)\] ]]
then
# Parse commit and hash into list
IFS="::" read -r -a tuple <<< "$line"
if [[ $exit_code == 0 ]]; then
printf "\n%sMissing commit message label:%s\n\n" "$red" "$end"
fi
printf "\t%s\t\t%s\n" "${tuple[2]}" "${tuple[0]}"
exit_code=1
fi
done <<< "$(git log origin/master..HEAD --pretty=format:'%s::%h')"
printf "\n"
exit $exit_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment