Skip to content

Commit 7235178

Browse files
committed
lint: Remove travis env var from commit linter
1 parent a787428 commit 7235178

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/lint/lint-git-commit-check.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,22 @@ while getopts "?" opt; do
1414
case $opt in
1515
?)
1616
echo "Usage: $0 [N]"
17-
echo " TRAVIS_COMMIT_RANGE='<commit range>' $0"
17+
echo " COMMIT_RANGE='<commit range>' $0"
1818
echo " $0 -?"
1919
echo "Checks unmerged commits, the previous N commits, or a commit range."
20-
echo "TRAVIS_COMMIT_RANGE='47ba2c3...ee50c9e' $0"
20+
echo "COMMIT_RANGE='47ba2c3...ee50c9e' $0"
2121
exit ${EXIT_CODE}
2222
;;
2323
esac
2424
done
2525

26-
if [ -z "${TRAVIS_COMMIT_RANGE}" ]; then
27-
if [ -n "$1" ]; then
28-
TRAVIS_COMMIT_RANGE="HEAD~$1...HEAD"
29-
else
30-
TRAVIS_COMMIT_RANGE="origin/master..HEAD"
31-
fi
26+
if [ -z "${COMMIT_RANGE}" ]; then
27+
if [ -n "$1" ]; then
28+
COMMIT_RANGE="HEAD~$1...HEAD"
29+
else
30+
MERGE_BASE=$(git merge-base HEAD master)
31+
COMMIT_RANGE="$MERGE_BASE..HEAD"
32+
fi
3233
fi
3334

3435
while IFS= read -r commit_hash || [[ -n "$commit_hash" ]]; do
@@ -41,6 +42,6 @@ while IFS= read -r commit_hash || [[ -n "$commit_hash" ]]; do
4142
EXIT_CODE=1
4243
fi
4344
done < <(git log --format=%B -n 1 "$commit_hash")
44-
done < <(git log "${TRAVIS_COMMIT_RANGE}" --format=%H)
45+
done < <(git log "${COMMIT_RANGE}" --format=%H)
4546

4647
exit ${EXIT_CODE}

0 commit comments

Comments
 (0)