This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #! /usr/ bin/env bash
22# Copyright 2017 The Go Authors. All rights reserved.
33# Use of this source code is governed by a BSD-style
44# license that can be found in the LICENSE file.
88
99set -e -o pipefail
1010
11- # TRAVIS_BRANCH is the name of the branch targeted by the pull request.
12- # but we won't have that set if running locally
13- if [ -z " $TRAVIS_BRANCH " ]; then
14- VALIDATE_REPO=
' [email protected] :golang/dep.git' 11+ if [ -z " $VALIDATE_UPSTREAM " ]; then
12+ VALIDATE_REPO=' https://github.com/golang/dep.git'
1513 VALIDATE_BRANCH=' master'
1614
15+ VALIDATE_HEAD=" $( git rev-parse --verify HEAD) "
16+
1717 git fetch -q " $VALIDATE_REPO " " refs/heads/$VALIDATE_BRANCH "
18- TRAVIS_BRANCH=" $( git rev-parse --verify FETCH_HEAD) "
19- fi
18+ VALIDATE_UPSTREAM=" $( git rev-parse --verify FETCH_HEAD) "
2019
21- VALIDATE_HEAD=" $( git rev-parse --verify HEAD) "
20+ VALIDATE_COMMIT_DIFF=" $VALIDATE_UPSTREAM ...$VALIDATE_HEAD "
21+
22+ validate_diff () {
23+ if [ " $VALIDATE_UPSTREAM " != " $VALIDATE_HEAD " ]; then
24+ git diff " $VALIDATE_COMMIT_DIFF " " $@ "
25+ fi
26+ }
27+ fi
2228
2329IFS=$' \n '
24- files=( $( git diff " $TRAVIS_BRANCH ... $VALIDATE_HEAD " --diff-filter=ACMR --name-only -- ' Gopkg.toml' ' Gopkg.lock' ' vendor/' || true) )
30+ files=( $( validate_diff --diff-filter=ACMR --name-only -- ' Gopkg.toml' ' Gopkg.lock' ' vendor/' || true) )
2531unset IFS
2632
2733if [ ${# files[@]} -gt 0 ]; then
2834 # We run ensure to and see if we have a diff afterwards
29- go build
35+ go install ./cmd/dep
3036 ./dep ensure
3137 # Let see if the working directory is clean
3238 diffs=" $( git status --porcelain -- vendor Gopkg.toml Gopkg.lock 2> /dev/null) "
You can’t perform that action at this time.
0 commit comments