commit-message-list: Don't print anything if no commits.

This fixes some output spam when running the linter at
upstream/master.
This commit is contained in:
Tim Abbott 2018-03-02 11:49:46 -08:00
parent ea7ce7e0da
commit 895b5642f1
1 changed files with 6 additions and 1 deletions

View File

@ -12,4 +12,9 @@ else
range="upstream/master..HEAD"
fi
gitlint --commits $range
commits=$(git log "$range" | wc -l)
if [ "$commits" -gt 0 ]; then
# Only run gitlint with non-empty commit lists, to avoid a printed
# warning.
gitlint --commits "$range"
fi