commit-message-lint: Detect the upstream remote name.

My upstream remote is named origin, so commit-message-lint was always
complaining at me.  Detect the right remote name from the output of
`git remote -v`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-04 04:48:17 -08:00 committed by Tim Abbott
parent b975d693bd
commit fa558de6d8
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,12 @@
if [ "$TRAVIS" ]; then
# Work around https://github.com/travis-ci/travis-ci/issues/4596
range="${TRAVIS_COMMIT_RANGE/.../..}"
elif [[ "
$(git remote -v)
" =~ '
'([^[:space:]]*)[[:space:]]*(https://github\.com/|ssh://git@github\.com/|git@github\.com:)zulip/zulip(\.git|/)?\ \(fetch\)'
' ]]; then
range="${BASH_REMATCH[1]}/master..HEAD"
else
range="upstream/master..HEAD"
fi