Skip to content

Commit

Permalink
fix: adjust commit message check to work with multi line commits
Browse files Browse the repository at this point in the history
The previous check relied on the tail command in order to strip the first line of git rev-list
containing the commit hash. However, the command worked only for single line commit messages.
git log gives essentially the same output, so use it instead.
  • Loading branch information
FabianScheidt authored and pppmlt committed Jan 5, 2023
1 parent 1abebe6 commit 1e40075
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ then
for commit_hash in ${rev_list}
do
# read the commit message and store it in a temporary file
git rev-list --format=%B --max-count=1 ${commit_hash} | tail --lines=2 > .tmp_commit_msg_storage
git log --format=%B --max-count=1 ${commit_hash} > .tmp_commit_msg_storage
echo "Now analyzing commit message of ${commit_hash}:"
echo "-----------"
cat .tmp_commit_msg_storage
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ then
for commit_hash in ${rev_list}
do
# read the commit message and store it in a temporary file
git rev-list --format=%B --max-count=1 ${commit_hash} | tail --lines=2 > .tmp_commit_msg_storage
git log --format=%B --max-count=1 ${commit_hash} > .tmp_commit_msg_storage
echo "Now analyzing commit message of ${commit_hash}:"
echo "-----------"
cat .tmp_commit_msg_storage
Expand Down

0 comments on commit 1e40075

Please sign in to comment.