2017-04-21 09:23:45 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-09-15 19:38:54 +00:00
|
|
|
|
2017-02-01 23:49:32 +00:00
|
|
|
if [ -z "${VALIDATE_UPSTREAM:-}" ]; then
|
2015-09-15 19:38:54 +00:00
|
|
|
# this is kind of an expensive check, so let's not do this twice if we
|
|
|
|
# are running more than one validate bundlescript
|
2016-02-19 11:58:06 +00:00
|
|
|
|
2016-02-24 15:43:39 +00:00
|
|
|
VALIDATE_REPO='https://github.com/containous/traefik.git'
|
2015-09-15 19:38:54 +00:00
|
|
|
VALIDATE_BRANCH='master'
|
2016-02-19 11:58:06 +00:00
|
|
|
|
|
|
|
# Should not be needed for now O:)
|
|
|
|
# if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
|
|
|
|
# VALIDATE_REPO="https://github.com/${TRAVIS_REPO_SLUG}.git"
|
|
|
|
# VALIDATE_BRANCH="${TRAVIS_BRANCH}"
|
|
|
|
# fi
|
|
|
|
|
2015-09-15 19:38:54 +00:00
|
|
|
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
2016-02-19 11:58:06 +00:00
|
|
|
|
2015-09-15 19:38:54 +00:00
|
|
|
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
|
|
|
|
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
|
2016-02-19 11:58:06 +00:00
|
|
|
|
2015-09-15 19:38:54 +00:00
|
|
|
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
|
|
|
|
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
2016-02-19 11:58:06 +00:00
|
|
|
|
2015-09-15 19:38:54 +00:00
|
|
|
validate_diff() {
|
|
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
|
|
|
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
validate_log() {
|
|
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
|
|
|
git log "$VALIDATE_COMMIT_LOG" "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
fi
|