Skip to content

Commit

Permalink
lint: Fix gitlint test due to non-deterministic git range.
Browse files Browse the repository at this point in the history
This makes getting the commit SHA non time sensitive by using the
range provided by TravisCI.
  • Loading branch information
tommyip committed Apr 22, 2017
1 parent 5ae284d commit a67ade2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ env:
- COVERALLS_SERVICE_NAME=travis-pro
- COVERALLS_REPO_TOKEN=hnXUEBKsORKHc8xIENGs9JjktlTb2HKlG
- BOTO_CONFIG=/tmp/nowhere
- UPSTREAM_MASTER=$(git ls-remote git://github.com/zulip/zulip.git refs/heads/master | cut -f 1)
language: python
matrix:
include:
Expand Down
14 changes: 8 additions & 6 deletions tools/commit-message-lint
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

# Lints all commit messages that are newer than upstream/master.
# Lint all commit messages that are newer than upstream/master if running
# locally or the commits in the push or PR if in TravisCI.

# The rules can be found in /.gitlint

# If this script is running on TravisCI, $UPSTREAM_MASTER would be set to the
# latest HEAD in travis.yml
if [ ! $TRAVIS ]; then
UPSTREAM_MASTER=upstream/master
if [ $TRAVIS ]; then
range=$TRAVIS_COMMIT_RANGE
else
range="upstream/master...HEAD"
fi

gitlint --commits $UPSTREAM_MASTER...HEAD
gitlint --commits $range

0 comments on commit a67ade2

Please sign in to comment.