Skip to content

Commit d17cc86

Browse files
authored
Add check for multiple commits (#4)
2 parents a2d5ac9 + 0649435 commit d17cc86

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ cache:
1414
install:
1515
- pip3 install textblob
1616
- python3 -m textblob.download_corpora
17+
- git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
18+
- git fetch --all
1719

1820
script:
1921
# Run the unit tests (you probably don't need to run this in your CI)
2022
- pytest bad_commit_message_blocker_tests.py
21-
# Run the script passing the current commit message as argument
22-
- python3 bad_commit_message_blocker.py --message "$TRAVIS_COMMIT_MESSAGE"
23+
# Verify that all commit messages in current branch abide by the best practices
24+
- bash multiple_commits.sh

multiple_commits.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
commits_since_master=$(git rev-list HEAD ^origin/master)
5+
6+
while read -r commit_hash; do
7+
commit_message="$(git log --format=%B -n 1 $commit_hash)"
8+
python3 bad_commit_message_blocker.py --message "$commit_message"
9+
done <<< "$commits_since_master"

0 commit comments

Comments
 (0)