#!/bin/sh [ -f $GIT_DIR/MERGE_MSG ] && exit 0 COMMIT_MSG_FILE=$1 COMMIT_SOURCE=$2 SHA1=$3 quote1=$(ruby ~/vitor/quotes/quote.rb) quote2=$(ruby ~/vitor/quotes/quote.rb --color) # Only add custom message when there is no commit source if [[ -z "$COMMIT_SOURCE" ]] then CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) if [[ $CURRENT_BRANCH =~ ^(.+\/)?([A-Z]+-[0-9]*).* ]] then JIRA_ID="${BASH_REMATCH[2]}" hint=$(cat "$COMMIT_MSG_FILE") echo "[${JIRA_ID}] " > "$COMMIT_MSG_FILE" echo "$hint" >> "$COMMIT_MSG_FILE" echo "# Quote of the commit:\n#\t${quote1}" >> "$COMMIT_MSG_FILE" echo "#\n#\n# Quote of the commit:\n#\n# ${quote2}\n#\n#\n" fi fi