2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2014-04-04 02:37:50 -04:00
|
|
|
|
2016-10-12 15:25:49 -04:00
|
|
|
set -e -o pipefail
|
|
|
|
|
2014-04-04 02:37:50 -04:00
|
|
|
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
|
|
|
# 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 13:38:17 -04:00
|
|
|
|
2014-07-24 18:19:50 -04:00
|
|
|
VALIDATE_REPO='https://github.com/docker/docker.git'
|
2014-04-04 02:37:50 -04:00
|
|
|
VALIDATE_BRANCH='master'
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2014-04-04 02:37:50 -04:00
|
|
|
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2014-04-04 02:37:50 -04:00
|
|
|
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
|
|
|
|
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2014-04-04 02:37:50 -04:00
|
|
|
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
|
|
|
|
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
2015-03-25 13:38:17 -04:00
|
|
|
|
2014-04-04 02:37:50 -04: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
|