Skip to content

Commit

Permalink
fix(pre-commit): fix broken parts issue
Browse files Browse the repository at this point in the history
Removing comments from commit message before validating it
  • Loading branch information
Anis Da Silva Campos committed Sep 11, 2020
1 parent 2b192f3 commit e7785d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions check_message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ then
exit
fi

MESSAGE=$(<"$1")
# removing comment lines from message
MESSAGE=$(sed '/^#/d' "$1")

FIRST_WORD=${MESSAGE%% *}
if [[ "${FIRST_WORD,,}" == merge ]]
Expand All @@ -44,6 +45,6 @@ fi
# print message so you don't lose it in case of errors
# (in case you are not using `-m` option)
echo "Options: JIRA=$COMMIT_VALIDATOR_NO_JIRA, TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP"
printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$(grep -v "#" <<< "$MESSAGE")"
printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$MESSAGE"

validate "$MESSAGE"

0 comments on commit e7785d6

Please sign in to comment.