2017-02-13 19:01:54 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-04-04 06:37:50 +00:00
|
|
|
|
2016-10-12 19:25:49 +00:00
|
|
|
set -e -o pipefail
|
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
2014-04-04 06:37:50 +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
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2019-01-30 21:16:16 +00:00
|
|
|
VALIDATE_REPO="${VALIDATE_REPO:-https://github.com/docker/docker.git}"
|
|
|
|
VALIDATE_BRANCH="${VALIDATE_BRANCH:-master}"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2014-04-04 06:37:50 +00:00
|
|
|
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2019-02-04 19:05:10 +00:00
|
|
|
if [ -z "$VALIDATE_ORIGIN_BRANCH" ]; then
|
|
|
|
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
|
|
|
|
VALIDATE_ORIGIN_BRANCH=FETCH_HEAD
|
|
|
|
fi
|
|
|
|
VALIDATE_UPSTREAM="$(git rev-parse --verify $VALIDATE_ORIGIN_BRANCH)"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2014-04-04 06:37:50 +00:00
|
|
|
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
|
|
|
|
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
2015-03-25 17:38:17 +00:00
|
|
|
|
2014-04-04 06:37:50 +00:00
|
|
|
validate_diff() {
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
2014-04-04 06:37:50 +00:00
|
|
|
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
validate_log() {
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
2014-04-04 06:37:50 +00:00
|
|
|
git log "$VALIDATE_COMMIT_LOG" "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
fi
|