Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COMMIT_FILE=$1
- COMMIT_MSG=$(cat $1)
- CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
- JIRA_ID=$(echo "$CURRENT_BRANCH" | grep -Eo "[A-Z0-9]{1,10}-?[A-Z0-9]+-\d+")
- IN_COMMIT=$(grep -c "$JIRA_ID:" $1)
- if ! [[ $IN_COMMIT -ge 1 ]] && [ ! -z "$JIRA_ID" ]; then
- echo "$JIRA_ID: $COMMIT_MSG" > $COMMIT_FILE
- echo "JIRA ID '$JIRA_ID' matched in current branch name, prepended to commit message. (Use --no-verify to skip)"
- fi
Add Comment
Please, Sign In to add comment